ExportInterface::getLabels should return a closure

This commit is contained in:
2016-12-22 17:56:53 +01:00
parent 49b3a7154e
commit e19868e595
3 changed files with 19 additions and 11 deletions

View File

@@ -574,7 +574,15 @@ class ExportManagerTest extends KernelTestCase
Argument::is(array(0, 1)),
Argument::Type('array')
)
->willReturn(array( 1 => 1, 0 => 0));
->willReturn(function($value) {
switch($value) {
case 0:
case 1:
return $value;
default: throw new \RuntimeException(sprintf("The value %s is not valid", $value));
}
});
$export->getQueryKeys(Argument::Type('array'))->willReturn(array('export'));
$export->getTitle()->willReturn('dummy title');
$exportManager->addExport($export->reveal(), 'dummy');
@@ -602,9 +610,14 @@ class ExportManagerTest extends KernelTestCase
Argument::is(array('cat a', 'cat b')),
Argument::is(array())
)
->willReturn(array(
'cat a' => 'label cat a', 'cat b' => 'label cat b'
));
->willReturn(function($value) {
switch ($value) {
case 'cat a' : return 'label cat a';
case 'cat b' : return 'label cat b';
default:
throw new \RuntimeException(sprintf("This value (%s) is not valid", $value));
}
});
$aggregator->addRole()->willReturn(null);
//$aggregator->addRole()->shouldBeCalled();
$exportManager->addAggregator($aggregator->reveal(), 'aggregator_foo');