PHPUnit – How to mock an object and its methods
When you start using PHPUnit, you often find yourself facing the need to simulate a method or object. Fortunately PHPUnit has some methods that can be very useful. How to simulate an object The easiest way to create a mocked object $product = $this->getMockBuilder(‘Product’) ->getMock(); or $product = $this->getMockBuilder(‘Product’) ->setMethods(array()) ->getMock(); This product is a … Read more