1 回答
TA贡献1804条经验 获得超7个赞
的目的getMockForTrait
是独立测试特征。您必须模拟该方法PagePublishValidator
:
public function testPreUpdateWithChildPageAndNewParent()
{
$rootPage = $this->buildPage('', 'root');
$validator = $this->getMockBuilder(PagePublishValidator::class)
->setMethods(['getPrevious'])
->setConstructorArgs([PageEventHandler::PAGE_TYPE_PRODUCT_LIST])
->getMock();
$validator->expects($this->once())
->method('getPrevious')
->with($rootPage)
->willReturn($rootPage);
$handler = new PageEventHandler(
$this->createAssertingMockProducer([], 0),
new NullProducer(),
$validator
);
$handler->preUpdate($rootPage);
}
- 1 回答
- 0 关注
- 92 浏览
添加回答
举报