phpunit - Serialization of 'MongoDB\Driver\Manager' is not allowed (php unit) -
i switched mongodb mongodb\driver\manager. re-wrote persistence class , persistencetest class. worked fine. restarted pc , test failed error message:
phpunit 5.7.21 sebastian bergmann , contributors. serialization of 'mongodb\driver\manager' not allowed
i simplified problem basic class , classtest.
the class:
class abc { protected $x; public function __construct() { $driveroptions = [ 'typemap' => [ 'root' => 'array', 'document' => 'array', 'array' => 'array' ] ]; $manager = new \mongodb\driver\manager("mongodb://user7:user777@localhost", [], $driveroptions); $this->x = new mongodb\database($manager, 'testdb', $driveroptions); $d = $this->x->{'testcollection'}->find(); foreach ($d $e) var_dump($e); } } $y = new abc();
the testclass:
class abctest extends phpunit_framework_testcase { public function test123(){} }
i working on windows php 5.6.30 phpunit 5.7.21 , "mongodb/mongodb": "1.1.2".
any ideas why worked in first place , got error message? , class works, called via apache, delivers content of testcollection without errors or warnings.
Comments
Post a Comment