protected function setUp() { $this->DataMapper = $this->getMockForAbstractClass('\\BLW\\Type\\IDataMapper', array(), '', false); $this->DataMapable = $this->getMockForAbstractClass('\\BLW\\Type\\ADataMapable'); $this->DataMapper->expects($this->any())->method('offsetGet')->will($this->returnCallback(array($this, 'mock_get'))); $this->DataMapper->expects($this->any())->method('offsetExists')->will($this->returnCallback(array($this, 'mock_isset'))); $this->DataMapper->expects($this->any())->method('offsetSet')->will($this->returnCallback(array($this, 'mock_set'))); $this->DataMapper->expects($this->any())->method('offsetUnset')->will($this->returnCallback(array($this, 'mock_unset'))); $Property = new ReflectionProperty($this->DataMapable, '_DataMapper'); $Property->setAccessible(true); $Property->setValue($this->DataMapable, $this->DataMapper); }
/** * @covers ::getErrorInfo */ public function test_getErrorInfo() { foreach ($this->generateErrors() as $Arguments) { list($Input, $Expected) = $Arguments; list($Messge, $Level) = $this->DataMapper->getErrorInfo($Input, 'foo', 'bar'); $this->assertContains($Expected, $Messge, 'IDataMapper::getErrorInfo() Returned an invalid result'); } # Unkown $this->assertNull($this->DataMapper->getErrorInfo(-1, 'foo', 'bar'), 'IDataMapper::getErrorInfo() Returned an invalid result'); }