mardi 31 mai 2016

PHPUnit - assert method call order on different mocks

I would like to test a method that just call a method of my entity object and persists it to the database.

public function setNameAndPersistObject($entityObject) {
    $entityObject->setName("John");
    $this->entityManager->persist($entityObject);
}

I would like to test the call order of the called methods, to test that 'persist' gets called after 'setName', so the new name "John" gets saved in the database. How would I do that in PHPUnit?

Aucun commentaire:

Enregistrer un commentaire