要测试的代码:
// Add the activation provider argument to the factory definition
$factoryDefinition = $container->getDefinition('gremo_subscription_factory');
$factoryDefinition->addArgument(new Reference($providerId));
测试方法应该检查addArgument
方法,包括$providerId
参数。我只是在学习 PHPUnit,现在我只能打电话$this->anything()
:
$container->expects($this->at(3))
->method('getDefinition')
->with('gremo_subscription_factory')
->will($this->returnValue($factory));
$factory->expects($this->once())
->method('addArgument')
->with($this->anything());
$this->pass->process($container);
如何检查参数类型是Reference
类,并且(反过来)它的参数正是字符串$providerId
?