Xdebug and Drupal8 tests (PhpUnit and Simpletest)
-
Upload
francisco-jose-seva-mora -
Category
Software
-
view
433 -
download
2
Transcript of Xdebug and Drupal8 tests (PhpUnit and Simpletest)
![Page 1: Xdebug and Drupal8 tests (PhpUnit and Simpletest)](https://reader034.fdocuments.us/reader034/viewer/2022042701/55a689181a28ab501e8b4798/html5/thumbnails/1.jpg)
Xdebug with PHPUnitIn Drupal 8
![Page 2: Xdebug and Drupal8 tests (PhpUnit and Simpletest)](https://reader034.fdocuments.us/reader034/viewer/2022042701/55a689181a28ab501e8b4798/html5/thumbnails/2.jpg)
About me
![Page 3: Xdebug and Drupal8 tests (PhpUnit and Simpletest)](https://reader034.fdocuments.us/reader034/viewer/2022042701/55a689181a28ab501e8b4798/html5/thumbnails/3.jpg)
Intro: XDebug
Depuración en PHP:● print_r(), var_dump(), …● FirePHP● Kint , Krumo, Ladybug● phpdbg incluido ya en 5.6
![Page 4: Xdebug and Drupal8 tests (PhpUnit and Simpletest)](https://reader034.fdocuments.us/reader034/viewer/2022042701/55a689181a28ab501e8b4798/html5/thumbnails/4.jpg)
Intro: XDebug
● Debugging and profiling PHP extension● Show log trace information● Allow step by step debugging
More info
![Page 5: Xdebug and Drupal8 tests (PhpUnit and Simpletest)](https://reader034.fdocuments.us/reader034/viewer/2022042701/55a689181a28ab501e8b4798/html5/thumbnails/5.jpg)
Intro: XDebug - My experience
I feel secure on my own!!! butIt’s not the holy grail
![Page 6: Xdebug and Drupal8 tests (PhpUnit and Simpletest)](https://reader034.fdocuments.us/reader034/viewer/2022042701/55a689181a28ab501e8b4798/html5/thumbnails/6.jpg)
Xdebug installation + configuration:PHP extension
+System configuration
+IDE configuration
+Browser configuration
![Page 7: Xdebug and Drupal8 tests (PhpUnit and Simpletest)](https://reader034.fdocuments.us/reader034/viewer/2022042701/55a689181a28ab501e8b4798/html5/thumbnails/7.jpg)
Xdebug installation: PHP extension
sudo apt-get install php5-xdebug
http://xdebug.org/docs/install
![Page 8: Xdebug and Drupal8 tests (PhpUnit and Simpletest)](https://reader034.fdocuments.us/reader034/viewer/2022042701/55a689181a28ab501e8b4798/html5/thumbnails/8.jpg)
Xdebug installation: System configuration
● zend_extension="/usr/lib/php5/20121212/xdebug.so"● xdebug.remote_enable=1● xdebug.remote_host= IDE host● xdebug.remote_port="9000"● xdebug.profiler_enable=1● xdebug.profiler_output_dir="/tmp"● xdebug.idekey="drupal8"
/etc/php5/apache2/php.ini AND/OR /etc/php5/cli/php.ini
![Page 9: Xdebug and Drupal8 tests (PhpUnit and Simpletest)](https://reader034.fdocuments.us/reader034/viewer/2022042701/55a689181a28ab501e8b4798/html5/thumbnails/9.jpg)
How do we check it?
Web: echo phpinfo();
![Page 10: Xdebug and Drupal8 tests (PhpUnit and Simpletest)](https://reader034.fdocuments.us/reader034/viewer/2022042701/55a689181a28ab501e8b4798/html5/thumbnails/10.jpg)
Xdebug installation: How do we check it?Console (cli): php -v & php -i | grep remote
![Page 11: Xdebug and Drupal8 tests (PhpUnit and Simpletest)](https://reader034.fdocuments.us/reader034/viewer/2022042701/55a689181a28ab501e8b4798/html5/thumbnails/11.jpg)
IDE configuration
● Set Xdebug in PhpStorm● Add a Php remote debug / Php Unit instance
in PhpStorm● Set session id (ide key)
![Page 12: Xdebug and Drupal8 tests (PhpUnit and Simpletest)](https://reader034.fdocuments.us/reader034/viewer/2022042701/55a689181a28ab501e8b4798/html5/thumbnails/12.jpg)
IDE configuration: Set XDebug
● Configure Php debug● Configure server
![Page 13: Xdebug and Drupal8 tests (PhpUnit and Simpletest)](https://reader034.fdocuments.us/reader034/viewer/2022042701/55a689181a28ab501e8b4798/html5/thumbnails/13.jpg)
IDE configuration: Debug instance
Open Debug panel pressing F9 and select Edit configuration
Add new PHP Remote Debug instance
Set the ide key (session id)and server
![Page 14: Xdebug and Drupal8 tests (PhpUnit and Simpletest)](https://reader034.fdocuments.us/reader034/viewer/2022042701/55a689181a28ab501e8b4798/html5/thumbnails/14.jpg)
Browser configuration
● The IDE needs an Id to start the debug● The browser provides the Id (session_id)● Chrome / Firefox extension to provide Id
○ Xdebug helper
![Page 15: Xdebug and Drupal8 tests (PhpUnit and Simpletest)](https://reader034.fdocuments.us/reader034/viewer/2022042701/55a689181a28ab501e8b4798/html5/thumbnails/15.jpg)
Use case : Debug code (I)● Drupal 8 installed in local● XDebug installed in local● PhpStorm configured with an instance
● Add breakpoint in code● Run debug mode● Navigate to stop in the breakpoint
Environment configuration:
Use case:
This is my day by day use of XDebug.
![Page 16: Xdebug and Drupal8 tests (PhpUnit and Simpletest)](https://reader034.fdocuments.us/reader034/viewer/2022042701/55a689181a28ab501e8b4798/html5/thumbnails/16.jpg)
Use case : Debug code (II)● Drupal 8 installed in remote environment (vagrant)● XDebug installed in remote environment (vagrant)● PhpStorm configured with a sync code to remote env.
● Add breakpoint in code● Run debug mode● Navigate to stop in the breakpoint
Environment configuration:
Use case:
This is @LuisGonRod day by day use of XDebug.
![Page 17: Xdebug and Drupal8 tests (PhpUnit and Simpletest)](https://reader034.fdocuments.us/reader034/viewer/2022042701/55a689181a28ab501e8b4798/html5/thumbnails/17.jpg)
Use case : Debug code (III)Question: What if @LuisGonRod and me want debug in the same remote environment?
http://derickrethans.nl/debugging-with-multiple-users.html
![Page 18: Xdebug and Drupal8 tests (PhpUnit and Simpletest)](https://reader034.fdocuments.us/reader034/viewer/2022042701/55a689181a28ab501e8b4798/html5/thumbnails/18.jpg)
Use case : Debug code (III)
![Page 19: Xdebug and Drupal8 tests (PhpUnit and Simpletest)](https://reader034.fdocuments.us/reader034/viewer/2022042701/55a689181a28ab501e8b4798/html5/thumbnails/19.jpg)
Use case : Debug tests (I)● Drupal 8 installed in local● XDebug installed in local● PhpStorm configured with an instance
● Activate module Testing● Run test Drupal\node\Tests\PageEditTest
Environment configuration:
Running test by using browser
Use case● Add breakpoint in test code● Run debug mode● Run test and wait to stop in breakpoint
Sometimes never stop...at least for me
![Page 20: Xdebug and Drupal8 tests (PhpUnit and Simpletest)](https://reader034.fdocuments.us/reader034/viewer/2022042701/55a689181a28ab501e8b4798/html5/thumbnails/20.jpg)
Use case : Debug tests (II)● Drupal 8 installed in local● XDebug installed in local● PhpStorm configured with an instance
● Activate module Testing● Run test using
○ run-tests.sh script○ drush test-run
Environment configuration:
Running test by using Php cli
![Page 21: Xdebug and Drupal8 tests (PhpUnit and Simpletest)](https://reader034.fdocuments.us/reader034/viewer/2022042701/55a689181a28ab501e8b4798/html5/thumbnails/21.jpg)
Use case : Debug tests - run-tests.sh (III)
configuring the script using PhpStorm it works
XDEBUG_CONFIG="idekey=drupal8" sudo php core/scripts/run-tests.sh --php /usr/bin/php --url http://local.drupal --class "Drupal\node\Tests\PageEditTest"
For me it’s not working, right now :(
![Page 22: Xdebug and Drupal8 tests (PhpUnit and Simpletest)](https://reader034.fdocuments.us/reader034/viewer/2022042701/55a689181a28ab501e8b4798/html5/thumbnails/22.jpg)
Use case : Debug tests - run-tests.sh (IV)● Go to debug configuration (F9)● Add a Php Script instance● Configure it
○ File: path to run-tests.sh○ Arguments: The run-tests parameters○ Environment variables: XDEBUG_CONFIG with idekey
![Page 23: Xdebug and Drupal8 tests (PhpUnit and Simpletest)](https://reader034.fdocuments.us/reader034/viewer/2022042701/55a689181a28ab501e8b4798/html5/thumbnails/23.jpg)
Use case : Debug tests - drush test-run (V)drush test-run --uri= local.drupal Drupal\node\Tests\PageEditTest
![Page 24: Xdebug and Drupal8 tests (PhpUnit and Simpletest)](https://reader034.fdocuments.us/reader034/viewer/2022042701/55a689181a28ab501e8b4798/html5/thumbnails/24.jpg)
...And what about PHPUnit?We can debug PHPUnit tests using Phpstorm adding a PHPUnit or PHPUnit on server instance
![Page 25: Xdebug and Drupal8 tests (PhpUnit and Simpletest)](https://reader034.fdocuments.us/reader034/viewer/2022042701/55a689181a28ab501e8b4798/html5/thumbnails/25.jpg)
what about PHPUnit and php cli?We can run test through runt-tests.sh script or
php scripts/run-tests.sh --php /usr/bin/php PHPUnit
![Page 26: Xdebug and Drupal8 tests (PhpUnit and Simpletest)](https://reader034.fdocuments.us/reader034/viewer/2022042701/55a689181a28ab501e8b4798/html5/thumbnails/26.jpg)
And now...what?
![Page 27: Xdebug and Drupal8 tests (PhpUnit and Simpletest)](https://reader034.fdocuments.us/reader034/viewer/2022042701/55a689181a28ab501e8b4798/html5/thumbnails/27.jpg)
Do you know why we have moustache?
● Configuraciones especiales de Xdebug● Si lanzamos los test por consola no tenemos
la cookie del navegador.
![Page 28: Xdebug and Drupal8 tests (PhpUnit and Simpletest)](https://reader034.fdocuments.us/reader034/viewer/2022042701/55a689181a28ab501e8b4798/html5/thumbnails/28.jpg)
Movember and Drupal community
If you can, please, donate.you won’t be the only one, maybe in that room you find some moustaches in @jose_lakatos @jsbalsera @penyaskito and @gloobhttp://es.movember.com/en/team/1674337http://es.movember.com/mospace/10983485