¡@

Home 

php Programming Glossary: mock

Insert/update helper function using PDO

http://stackoverflow.com/questions/3773406/insert-update-helper-function-using-pdo

and using rtrim over substr . Going to work on providing a mock up of a PDO Extension class just gotta layout the way to do..

Who needs singletons? [closed]

http://stackoverflow.com/questions/4595964/who-needs-singletons

issue . Sometimes you want to replace your database with a mock database. In effect this is a second instance of the database.. classes than it is with a singleton you only have to mock out the getInstance method not every single method in a static..

Inversion of Control Container for PHP? [closed]

http://stackoverflow.com/questions/52072/inversion-of-control-container-for-php

my own hacked together IoC container just to inject all my mock objects properly. Has anyone used an Ioc container in php All..

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

you can indeed replace all the dependencies by stubbing or mock them. A test double will pretend to be the real thing. mock.. them. A test double will pretend to be the real thing. mock this getMock 'MyWebservice' mock expects this once method 'findById'.. to be the real thing. mock this getMock 'MyWebservice' mock expects this once method 'findById' with this equalTo 1 will..

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

different arguments Is it possible to configure PHPUnit mock in this way context this getMockBuilder 'Context' getMock context.. expectation is rewriting the first one but when I dump the mock everything looks ok. php mocking phpunit share improve this.. one but when I dump the mock everything looks ok. php mocking phpunit share improve this question As of PHPUnit 3.6..

How should a model be structured in MVC?

http://stackoverflow.com/questions/5863870/how-should-a-model-be-structured-in-mvc

from. It might be a database but it also might be just a mock object for testing purposes. P.S. This would also be the part..

PhpUnit private method testing

http://stackoverflow.com/questions/5937845/phpunit-private-method-testing

c some code The question is how can i simulate the result mocking it of the private method to improve the second some code.. improve this question Usually you just don't test or mock the private protected methods directy. What you want to test.. c return mt_rand 1 3 i can see the need to want to mock out c since the random function is global state and you can't..

unit testing and Static methods

http://stackoverflow.com/questions/5961023/unit-testing-and-static-methods

During the instantiation I wire the dependencies with mocks friendlies which replace the real dependencies. With procedural.. on Database and Log instances the test could pass in mock objects with scripted return values specific to the test at..

php singleton database connection, is this code bad practice?

http://stackoverflow.com/questions/9227400/php-singleton-database-connection-is-this-code-bad-practice

because you can't easily replace the singleton with a mock. They encourage a coding style where classes attempt to resolve..

Dependency Injection Pattern seems extreme in Control Class

http://stackoverflow.com/questions/10215010/dependency-injection-pattern-seems-extreme-in-control-class

stubs for mocking which is easy with your example class Mock public stub public function __call name args return class_exists.. stub new this stub this stub class ObjectMaker extends Mock public stub 'Mock' class ControlTryIt class SignOut class SessionWrap.. stub this stub class ObjectMaker extends Mock public stub 'Mock' class ControlTryIt class SignOut class SessionWrap public function..

PHPUnit Mock Objects and Static Methods

http://stackoverflow.com/questions/2357001/phpunit-mock-objects-and-static-methods

Mock Objects and Static Methods I am looking for the best way to.. of PHPUnit recently had a blog post about Stubbing and Mocking Static Methods . With PHPUnit 3.5 and PHP 5.3 as well as..

Parent Object in php

http://stackoverflow.com/questions/2423396/parent-object-in-php

easily swap out the Parent instance for instance with a Mock when UnitTesting. Using Dependency Injection will make your..

Would Singleton be a good design pattern for a microblogging site?

http://stackoverflow.com/questions/3870635/would-singleton-be-a-good-design-pattern-for-a-microblogging-site

dependencies with other implementations like for instance Mock classes for your UnitTests . Even Erich Gamma one of the Singleton..

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

doesn't really care where the data comes from. Introducing Mocks The good news is you can indeed replace all the dependencies.. double will pretend to be the real thing. mock this getMock 'MyWebservice' mock expects this once method 'findById' with.. reset Registry set 'MyWebservice' this getWebserviceMock this testSubject new MyTestSubject Great. You no longer have..

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

in PHPUnit multiple configuration of the same method with different.. 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..