Running tests in PhpStorm for Laravel Homestead vagrant VM - laravel

I've got a fresh installation of Laravel Homestead based on this: https://laravel.com/docs/master/homestead
And a fresh new project using Laravel new.
I'm trying to run the example tests through PhpStorm's "Run configurations" but I get
vagrant:///Users/si/vagrant/Homestead/usr/bin/php /home/vagrant/.phpstorm_helpers/phpunit.php --no-configuration /home/vagrant/Code/homestead/tests
Testing started at 00:49 ...
Process finished with exit code 1
Cannot find PHPUnit in include path (.:/usr/share/php)
In the PhpStorm PHPUnit settings I have the PHPUnit library loaded with "Use custom autoloader" pointing at the composer autoload.php file like this:
/Users/si/Code/homestead/vendor/autoload.php
And composer has added the PHPUnit executable at
/Users/si/Code/homestead/vendor/bin/phpunit
I'm confused as to why PhpStorm can't find this PHPUnit executable when I'm telling it to use the composer autoload to find it.

OK, I fixed this. I had added a remote interpreter in the PHP settings, but was still using 'local' settings in the PHPUnit settings. I added a new PHPUnit settings configuration 'By Remote Interpreter' in the Languages and Framdworks > PHP > PHPUnit settings screen.
I selected 'Use custom autoloader' and specified the following:
/home/vagrant/Code/homestead/vendor/autoload.php

Related

Xdebug of Laravel Dusk in Netbeans on Homestead

In Laravel Homestead, I've been able to use Xdebug for unit tests, feature tests, poking around in the browser, etc.
But it hangs when I try to use Xdebug for Dusk (tests in tests/Browser folder).
I thought these questions might help, but I still haven't gotten it working:
debugging laravel artisan from PHPStorm with homestead
Xdebug laravel artisan commands
I've tried various approaches, including:
export XDEBUG_CONFIG="idekey=netbeans-xdebug remote_connect_back=0 remote_host=10.0.2.2"
php artisan dusk
and
export XDEBUG_CONFIG="idekey=netbeans-xdebug remote_host=10.0.2.2"
php -dxdebug.remote_autostart=on -dxdebug.remote_connect_back=off -dxdebug.remote_host=10.0.2.2 artisan dusk
and more.
I've enabled the "Stop at First Line" debugging option in Netbeans, and Netbeans does successfully stop at the first executable PHP line in the artisan file.
Therefore I think export XDEBUG_CONFIG="idekey=netbeans-xdebug remote_connect_back=0 remote_host=10.0.2.2" is correctly set up.
But after I click the "play" button to allow the code to continue, Netbeans just says "netbeans-xdebug running" in the bottom right while the console just hangs with a cursor flashing under this line: php artisan dusk tests/Browser/ExampleTest.php
How do I need to change my usage of Xdebug for getting it to work in Dusk too?
It doesn't work because Dusk executes the actual PHPUnit test in a separate process, so it doesn't know about XDEBUG_CONFIG.
In principle, Dusk tests still work when you execute them directly (phpunit tests/Browser/ExampleTest.php). The main feature of php artisan dusk are custom .env.dusk[.local] files.
If you don't require that, you can try calling them directly. Then Xdebug should behave the same way it does with all your other PHPUnit tests.
As in my answer here, there is an option of running php -dxdebug.remote_enable=1 -dxdebug.remote_host=10.0.2.2 -dxdebug.remote_port=9000 -dxdebug.remote_handler=dbgp artisan my:command
You can also add those parameters to xdebug.ini like so:
zend_extension_ts = "./php/ext/php_xdebug<-version-number>.dll"
xdebug.remote_enable=1
xdebug.remote_host=10.0.2.2
; Port number must match debugger port number in NetBeans IDE Tools > Options > PHP
xdebug.remote_port=9000
xdebug.remote_handler=dbgp
xdebug.idekey=netbeans-xdebug (although I think it should work without this too)
Try removing break at first line option. Also try running debug directly from console with those options. And finally check that the correct port is set to listen in NetBeans and xdebug since that could cause problems too.

Behat + CircleCI Configuration for my drupal8 site

I am very new to drupal. I am using drupal8 with pantheon. I have created a site "ucfictious". I have created a local copy by using composer and drush. Everything went well and I configured behat tests which also went well. Now I am trying to configure CircleCI through github. I ran into so many errors and I couldn't solve my errors. Can anyone help me with the configuration of CircleCI? I am using Craychee's Work to build CircleCI and When I run I get the following error:
build/install.sh
Command config-import needs a higher bootstrap level to run - you [error]
will need to invoke drush from a more functional Drupal environment
to run this command.
The drush command 'config-import' could not be executed. [error]
Drush was not able to start (bootstrap) the Drupal database. [error]
Hint: This may occur when Drush is trying to:
* bootstrap a site that has not been installed or does not have a
configured database. In this case you can select another site with a
working database setup by specifying the URI to use with the --uri
parameter on the command line. See drush topic docs-aliases for
details.
Drupal Version: 8.2.5
Drush Version: 8.1.8
Php Vesion: 5.6
For Behat Configuration I followed Craychee's work: http://craychee.io/blog/2015/08/04/no-excuses-part4-testing/
Thanks.
Got it Working...My database is not populated properly.....by doing a sql-sync from the DEV environment (so it was a known-clean copy, i.e. not filled with testing junk) and then used mysqldump.

phpStorm command line command points to wrong project

i'm quite new with laravel and composer. I've made a project previously and that works like a expected. Now i've started a brand new project 'bloemenn' in phpstorm choose composer project for type and installed laravel. When i run the project i see the welcome page of laravel. So far so good
But now i'm trying to make a controller with the command line tool but every command i execute points to my very first directory project i ever made.
So the controls are made but in the wrong directory.
so when i execute following command in phpstorm for project bloemenn:
Artisan make:controller indexController
i get following result:
/Applications/MAMP/bin/php/php5.6.7/bin/php /Users/u-123/project-test/laravel/artisan make: indexController
so the controller is made in project laravel instead of directory of project bloemenn
Anyone have any idea how i can fix this, i have this issue for every new composer project i start up?
ok,
found it myself
under preferences->Tools->Command Line Tools Support can you specify witch to uses
mine all pointed to my first project

Error while creating migrations table with laravel: "No such file or directory"

When trying to run php artisan migrate:make create_users_table I get the following output in Windows CMD:
{"error":{"type":"ErrorException","message":"require(C:\...\\localhost
\\sites\\makeitsnappy\\app\/filters.php): failed to open stream: No such file or
directory","file":"C:\\...\localhost\\sites\\makeitsnappy\\app\\start
\\global.php","line":83}}
I'm running Windows 8. Laravel 4 and installed Composer, also ran composer update in the project folder. Same error happens.
Edit: Loading the application webpage, I get:
require(C:\.../localhost\sites\makeitsnappy\app/filters.php): failed to open stream: No such file or directory
Also, there is no filter.php file.
How can I fix this problem?
Since Laravel4 the routes and filters are in two different files: routes.php and filters.php not like in Laravel3 where both lay in the same file.
Check if there is a filter.php file in you app/ folder.
The error occurs because the autoloader tries to load this file on application's startup to get the filters for the called route or global filters.
Running composer update won't help here because you only get the framework and it's dependencies via composer and it doesn't update your app/ folder.
did you do composer install? It downloads some important files. I think you missed this command!
composer install

Laravel 4 Workbench not working in Pagodabox

Im developing a library hand in hand with a project I'm working on in L4 and I'm doing it in a Workbench as recommended. I have set the Service Providers etc and it works fine on my local machine. However when I pust to Pagodabox, the console gives me this:
Error Output: PHP Fatal error: Class 'Coderollers\Formidable\FormidableServiceProvider' not found in /var/www/vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php on line 123
Clearly, for some reason, on Pagodabox it is looking for my service provider in the vendors folder rather than the workbench folder. Does anyone know why this might be?
For a workbench package to be loaded by Laravel it expects to find an autoload.php file within a vendor directory of your package. You'll need to run composer install from your workbench packages directory to install the package dependencies and have it dump an autoload file.
Once done Laravel will be able to detect and use your package.

Resources