I've recently set up PHPUnit in PHPStorm via Composer.
PDOException You cannot serialize or unserialize PDO instances I have searched for solution in the issues, and on the internet, but could not find any. Any kind of help would be really appreciated. PDOException: You cannot serialize or unserialize PDO instances I think the Session class needs to check if the storage can be serialized, maybe by using a NotSerializable interface, as @fabpot blogged about a while ago.
I'm trying to test some functionality that requires me to bootstrap Processwire (a CMS).
I keep constantly getting the message 'You cannot serialize or unserialize PDO instances' despite applying the conditions below which I researched to be the correct way of fixing this issue.
Is there anything else I have missed or need to do to get this working?
These are the resources I have referenced so far.
I've seen this article that flagged my article as a duplicate but I don't believe it to be the same :PDOException: You cannot serialize or unserialize PDO instances
The test in that article has direct references to the PDO object whereas I'm just trying to get my tests to run with a bootstrap reference to Processwire.This is my test I'm trying to run :
I finally figured it out! For whatever reason, setting the test environment variables in the test was having no effect.
By creating a phpunit.xml configuration, defining the test parameters and creating a reference to it in Phpstorm I was finally able to run the test.
For reference, this was the contents of my phpunit.xml
I don't think it matters where the file is placed but I placed it in the test folder where my tests resides.
And I had to reference it in PHPStorm by going through the menu (Language & Framework -> PHP -> PHPUnit) and in the Custom Autoloader section, selecting the default configuration file and pointing it to the phpxml file. If you're using a different method, then go to that menu and set the default configuration there.
Hope this helps somebody out there, as there isn't much information relating to PHPUnit & PHPStorm in conjunction.
Copyright © 2019 oilfullpac.