/** * @covers Paradox\Toolbox::setModelFormatter */ public function testSetModelFormatter() { //First we need to create a ReflectionClass object //passing in the class name as a variable $reflectionClass = new \ReflectionClass('Paradox\\Toolbox'); //Then we need to get the property we wish to test //and make it accessible $formatterProperty = $reflectionClass->getProperty('_formatter'); $formatterProperty->setAccessible(true); $formatter = $this->getMock('Paradox\\IModelFormatter'); $this->toolbox->setModelFormatter($formatter); $this->assertEquals($formatter, $formatterProperty->getValue($this->toolbox), "The formatter returned does not match the one we set into the toolbox"); }