代碼進行測試:如何使用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