代码进行测试:如何使用PHPUnit测试此方法调用?
// Add the activation provider argument to the factory definition
$factoryDefinition = $container->getDefinition('gremo_subscription_factory');
$factoryDefinition->addArgument(new Reference($providerId));
试验方法应该检查addArgument
方法,包括$providerId
说法。我只是learining 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
?
在新行上的分号看起来相当糟糕 – dynamic
@llnk同意...有关该问题的任何帮助? – gremo