当前位置: 动力学知识库 > 问答 > 编程问答 >

php - 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);

}

Both $entityObject and $entityManager are mocks, not actual objects.

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?

分享给朋友:
您可能感兴趣的文章:
随机阅读: