php Programming Glossary: getmock
Organizing PHPUnit Tests in Namespaces http://stackoverflow.com/questions/12117254/organizing-phpunit-tests-in-namespaces qualified pathes When we get the possibility to say this getMock AwesomeClass CLASS in PHP 5.5 instead of this getMock ' SomeFramework.. this getMock AwesomeClass CLASS in PHP 5.5 instead of this getMock ' SomeFramework Utilities AwesomeClass' every mock will require..
How can I get PHPUnit MockObjects to return differernt values based on a parameter? http://stackoverflow.com/questions/277914/how-can-i-get-phpunit-mockobjects-to-return-differernt-values-based-on-a-paramet matter what its arguments From inside a test... mock this getMock 'myObject' 'methodToMock' mock expects this any method 'methodToMock'.. to the mock method. I've tried something like mock this getMock 'myObject' 'methodToMock' methodToMock 'one' mock expects this.. public function testReturnCallbackStub stub this getMock 'SomeClass' array 'doSomething' stub expects this any method..
PHPUnit, mocked interfaces, and instanceof http://stackoverflow.com/questions/3250503/phpunit-mocked-interfaces-and-instanceof does not pass above check instance this getMock 'Interface' I understand that having a class named Interface.. share improve this question This works for me mock this getMock 'TestInterface' this assertTrue mock instanceof TestInterface..
Modifying objects in returnCallback() of PHPUnit Mocks http://stackoverflow.com/questions/4702132/modifying-objects-in-returncallback-of-phpunit-mocks foobar object doSomething And this setup code mock this getMockBuilder 'A' getMock mock expects this any method 'foobar' will.. And this setup code mock this getMockBuilder 'A' getMock mock expects this any method 'foobar' will this returnCallback.. public function testFoo mock this getMock 'A' mock expects this any method 'foobar' will this returnCallback..
How is testing Registry Pattern or Singleton hard in PHP? http://stackoverflow.com/questions/5283102/how-is-testing-registry-pattern-or-singleton-hard-in-php A test double will pretend to be the real thing. mock this getMock 'MyWebservice' mock expects this once method 'findById' with.. id Don't forget to change the Mock accordingly mock this getMock 'Finder' mock expects this once method 'findById' with this..
Mock in PHPUnit - multiple configuration of the same method with different arguments http://stackoverflow.com/questions/5484602/mock-in-phpunit-multiple-configuration-of-the-same-method-with-different-argum to configure PHPUnit mock in this way context this getMockBuilder 'Context' getMock context expects this any method 'offsetGet'.. mock in this way context this getMockBuilder 'Context' getMock context expects this any method 'offsetGet' with 'Matcher' will..
PhpUnit private method testing http://stackoverflow.com/questions/5937845/phpunit-private-method-testing set the function protected for this to work testMe this getMock a array c testMe expects this once method c will this returnValue..
unit testing and Static methods http://stackoverflow.com/questions/5961023/unit-testing-and-static-methods function testFindUserReturnsNullWhenNotFound log this getMock 'Log' ignore all logging calls database this getMock 'Database'.. this getMock 'Log' ignore all logging calls database this getMock 'Database' array 'connect' 'query' database expects this once..
Mocking concrete method in abstract class using phpunit http://stackoverflow.com/questions/8040296/mocking-concrete-method-in-abstract-class-using-phpunit making the test fragile and too verbose. MockBuilder getMockForAbstractClass ignores setMethod . Here are some unit tests.. methods. public function testAbstractMethod stub this getMockForAbstractClass 'AbstractClass' stub expects this any method.. methods too. public function testConcreteMethod stub this getMockForAbstractClass 'AbstractClass' stub expects this any method..
|