I want to mock some methods from an external dependency class without executing the original constructor for this external class. This external class is from somewhere else, imported to our project by composer for example.
First of all there is a useful article about integration between PHP and TeamCity in the documentation to TeamCity 8 called Getting started with PHP. It is worth to read it.
I want to mock different methods of the same class and mock one method with different argument values. Using standard PHPUnit.
Mocks in PHPUnit are being created using getMock() method. It belongs to
PHPUnit_Framework_TestCase class, that is described in
.../PEAR/PHPUnit/Framework/TestCase.php file. Continue reading
PHPUnit v 3.7 documetation says that we can run same test in different browsers. We have to create a descendant class from PHPUnit_Extensions_SeleniumTestCase with a special variable called $browsers.
While testing PHP we need sometimes to create a mock for a method with reference parameters. I use returnCallback() from PHPUnit framework to to this. returnCallback() will call a function that imitates functionality of the original method. The original method can be either public or protected.