php - PHPUnit constraints extension gives error "PHPUnit_Util_Type::export()" not found -


i want mock object can tell me if:

  1. when 1 of methods called
  2. that 1 of arguments passed method
  3. is array
  4. and has particular key/value pair.

i want use phpunit's constraints achieve, this, test code this:

$mock = $this->getmock('\jodes\myclass'); $mock->expects($this->once())         ->method('mymethod')         ->with(                 $this->logicaland(                     $this->istype('array'),                     $this->arrayhaspair('my_key', 'my_value'),                 )             ); // ... code here should call mock method 

in this previous question, guy ended writing own constraint.

i found this library seems implement quite few nifty things. installed adding line in composer.json's require section:

"etsy/phpunit-extensions": "@stable" 

but when try using it, error. use so:

class myclasstest extends phpunit_framework_testcase {     public function arrayhaspair($key, $value){         return new phpunit_extensions_constraint_arrayhaskeyvaluepair($key, $value);     }     public function testmymethod(){         // code per example above     } } 

but produces error:

php fatal error: call undefined method phpunit_util_type::export() in c:\myproject\vendor\etsy\phpunit-extensions\phpunit\extensions\constraint\arrayhaskeyvaluepair.php on line 50

this previous question/answer explains problem is, i'm not sure should it. mean developers of library have abandoned it? there alternative use? or options have fixing it? i'm amazed such basic constraints still don't exist in phpunit. write own constraints surely that's unnecessary?

the phpunit_util_type::export() method removed while ago. extension want use has updated compatible current versions of phpunit.


Comments

Popular posts from this blog

mysql - FireDac error 314 - but DLLs are in program directory -

git - How to list all releases of public repository with GitHub API V3 -

c++ - Getting C2512 "no default constructor" for `ClassA` error on the first parentheses of constructor for `ClassB`? -