stable

Clone or download

Read-only

Convert BuildItemMappingVisitorTest and some others

It exposes the last version of simpletest2mockery that support a nice conversion between the 2 mocking system. Alas there is one pitfall with mockery: default values. With simpletest everything that was not explicitely defined got false so $dar->setReturnValue('getRow', array(30)); $dar->setReturnValue('getRow', array(40)); Was good because we where able to to loop like while ($row = $dar->getRow()) and the third call to $dar->getRow() whould have got false and that terminate the loop. Mockery has a different strategy, the first value is the default value so, with $dar->shouldReceive('getRow')->once()->andReturns(30); $dar->shouldReceive('getRow')->once()->andReturns(40); The third call to $dar->getRow() will get 30 instead of false. Code that looks like that will not terminate (infinite loop), you will need to manually edit tests to have: $dar->shouldReceive('getRow')->once()->andReturns(30); $dar->shouldReceive('getRow')->once()->andReturns(40); $dar->shouldReceive('getRow')->once()->andReturns(false); This is why we can't have nice things. Part of story #11368 Convert docman tests to mockery Change-Id: Ieee6847c813e3f6bd0ca7ff1db39324f4d7b2b09

Modified Files

Name
M plugins/docman/tests/ApprovalTableNotificationCycleTest.php +34 −51 Go to diff View file
M plugins/docman/tests/BuildItemMappingVisitorTest.php +88 −83 Go to diff View file
M plugins/docman/tests/CopyItemsTest.php +25 −49 Go to diff View file
M plugins/docman/tests/Docman_SOAPActionsTest.php +2 −8 Go to diff View file
M plugins/docman/tests/ItemFactoryTest.php +22 −30 Go to diff View file
M plugins/docman/tests/MetadataListOfValuesElementDaoTest.php +10 −16 Go to diff View file
M plugins/docman/tests/MetadataTest.php +46 −66 Go to diff View file
M plugins/docman/tests/NotificationsManager_MoveTest.php +17 −30 Go to diff View file
M plugins/docman/tests/VersionFactoryTest.php +26 −48 Go to diff View file
M tests/simpletest/MockeryExamplesTest.php +29 −0 Go to diff View file