Welcome Guest, Not a member yet? Register   Sign In
testing with phpunit in phpstorm
#1

(This post was last modified: 11-22-2017, 10:12 AM by puschie.)

hey,
currently im trying to get phpunit run all tests ( include own application tests ) in phpstorm.

1. install all dependency via composer
  ( got an error on extractTo phpunit/php-code-coverage : no such file or stream | and git was not found : github.com/sebastianbergmann/php-code-coverage.git ) -> guess i dont need this for testing, so just as notice

2. download phpunit.phar and select it in Settings/Languages&Frameworks/PHP/TestFramework

when i try to run a test without the configuration file i get :
   Fatal error: Class 'CodeIgniter\Test\CIDatabaseTestCase' not found

when i try to run a test with the configuration file ( phpunit.xml.dist ) i get :
  require(application/Config/Paths.php): failed to open stream [...] \tests\_support\_bootstrap.php on line 10


im very new to phpunit - so maybe i miss some phpstorm configuration, but when i use the build-in test creation it work ( but i dont get codeignigter to run in a TestCase class )

thx for reading - hope someone had the same problems and solved it^^
Reply
#2

I found that with phpStorm it's a good idea to add a url mapping to the public folder.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#3

I do not know how to configure it with the PhpStorm GUI.

But is possible just go to you CodeIgniter 4 root dir with the terminal and run: ./phpunit

If you want to test a specific file: ./phpunit tests/system/CLI/CLITest.php
Reply
#4

hmm, i test it but i get many errors like : "Uncaught ErrorException: Undefined index [...] \TestLogger.php:35"
so the testing suit is broken ? i thougth it have to work out of the box ( as it works in the travis builds )
Reply
#5

its working now... had to set a custom working directory ( to CI4 root )
Reply
#6

I set all my projects to /htdocs/projectName that is my Root then I add another mapping to the public_html folder.
This is using XAMPP and Windoes 10 Pro.

Anything I need to test I just add a folder to the Root.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply




Theme © iAndrew 2016 - Forum software by © MyBB