diff --git a/tests/EventListener/DcaField/DateAddedFieldListenerTest.php b/tests/EventListener/DcaField/DateAddedFieldListenerTest.php index 49d1a931..18d9b6c6 100644 --- a/tests/EventListener/DcaField/DateAddedFieldListenerTest.php +++ b/tests/EventListener/DcaField/DateAddedFieldListenerTest.php @@ -48,11 +48,11 @@ public function testOnLoadDataContainer() public function dateAddedConfig():array { return [ - [null, false, false, false, false], - [1, true, false, false, false], - [2, false, true, false, false], - [null, false, false, true, false], - [null, false, false, false, true], + [null, false, false, false, false, null], + [1, true, false, false, false, []], + [2, false, true, false, false, ['testProp' => 'testValue']], + [null, false, false, true, false, ['a' => 'x', 'b' => 'y', 'c' => 99]], + [null, false, false, false, true, ['noSubmissionField' => true]], ]; } @@ -60,8 +60,10 @@ public function dateAddedConfig():array * @dataProvider dateAddedConfig * @runInSeparateProcess */ - public function testConfig(?int $flag, bool $sorting, bool $exclude, bool $filter, bool $search) + public function testConfig(?int $flag, bool $sorting, bool $exclude, bool $filter, bool $search, ?array $eval) { + $eval ??= []; + $container = $this->createMock(ContainerInterface::class); $listener = new DateAddedFieldListener($container); @@ -79,6 +81,9 @@ public function testConfig(?int $flag, bool $sorting, bool $exclude, bool $filte $config->setExclude($exclude); $config->setFilter($filter); $config->setSearch($search); + foreach ($eval as $key => $value) { + $config->setEvalValue($key, $value); + } $listener->onLoadDataContainer($table); @@ -104,6 +109,14 @@ public function testConfig(?int $flag, bool $sorting, bool $exclude, bool $filte $this->assertArrayHasKey('search', $field); $this->assertTrue($field['search']); } + if (!empty($eval)) { + $this->assertArrayHasKey('eval', $field); + $this->assertIsArray($field['eval']); + foreach ($eval as $key => $value) { + $this->assertArrayHasKey($key, $field['eval']); + $this->assertEquals($value, $field['eval'][$key]); + } + } } public function testOnLoadCallback()