Jump to content

Any PHPStorm users here who uses phpUnit? Setup question


FrancisChung
 Share

Recommended Posts

Hi fellow Processwirers (?),

I was wondering if anyone here uses PHPStorm in conjunction with PhpUnit?

In particular, I'm trying to get it to work with Processwire so I can incorporate the Pages & other intrinsic Processwire objects into the testing.

Any example or real life configuration examples would be most welcome.

Thanks in advance.

Link to comment
Share on other sites

In particular, I'm trying to get it to work with Processwire so I can incorporate the Pages & other intrinsic Processwire objects into the testing.

Essentially it's the same as bootstraping processwire in any other php file. But you'd need to make sure the host, which runs phpunit does have access to the mysql database, which processwire does connect to.

  • Like 1
Link to comment
Share on other sites

  • 1 month later...

I'm revisiting this question again as I haven't had time to tackle it until now.

I've managed to get it working via the Composer route.

Here are some links I used in case others are having issues.

http://stackoverflow.com/questions/18310259/cannot-find-phpunit-in-include-path-phpstorm (last answer)

https://jtreminio.com/2013/03/unit-testing-tutorial-introduction-to-phpunit/

https://www.jetbrains.com/phpstorm/help/enabling-phpunit-support.html (2nd item)

You may also need to mark your test directories under preferences -> project -> directory

Now I'm stuck on this error message "You cannot serialize or unserialize PDO instances" when running my tests.

It appears when I bootstrap the test to Processwire index.php.

Various publications have stated that I need to disable process isolation but it hasn't worked for me so far.

I was wondering if there's any other settings I need to do to make this work?

Edit: Now a Stackoverflow Question as well
http://stackoverflow.com/questions/34225720/keep-getting-you-cannot-serialize-or-unserialize-pdo-instances-in-phpunit-usin
 

Link to comment
Share on other sites

After spending hair pulling hours & days, I've figured it out.

I basically had to create a seperate phpunit.xml configuration file and go from there.

The details are in :

http://stackoverflow.com/questions/34225720/keep-getting-you-cannot-serialize-or-unserialize-pdo-instances-in-phpunit-usin/34231873#34231873

Link to comment
Share on other sites

  • 6 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...