1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* @copyright Copyright (C) eZ Systems AS. All rights reserved. |
5
|
|
|
* @license For full copyright and license information view LICENSE file distributed with this source code. |
6
|
|
|
*/ |
7
|
|
|
namespace eZ\Publish\Core\MVC\Symfony\Matcher\Tests\ContentBased; |
8
|
|
|
|
9
|
|
|
use eZ\Publish\Core\MVC\Symfony\Matcher\ContentBased\MultipleValued; |
10
|
|
|
|
11
|
|
|
class MultipleValuedTest extends BaseTest |
12
|
|
|
{ |
13
|
|
|
/** |
14
|
|
|
* @dataProvider matchingConfigProvider |
15
|
|
|
* @covers \eZ\Publish\Core\MVC\Symfony\Matcher\ContentBased\MultipleValued::setMatchingConfig |
16
|
|
|
* @covers \eZ\Publish\Core\MVC\Symfony\Matcher\ContentBased\MultipleValued::getValues |
17
|
|
|
*/ |
18
|
|
View Code Duplication |
public function testSetMatchingConfig($matchingConfig) |
19
|
|
|
{ |
20
|
|
|
$matcher = $this->getMultipleValuedMatcherMock(); |
21
|
|
|
$matcher->setMatchingConfig($matchingConfig); |
22
|
|
|
$values = $matcher->getValues(); |
23
|
|
|
$this->assertInternalType('array', $values); |
|
|
|
|
24
|
|
|
|
25
|
|
|
$matchingConfig = is_array($matchingConfig) ? $matchingConfig : [$matchingConfig]; |
26
|
|
|
foreach ($matchingConfig as $val) { |
27
|
|
|
$this->assertContains($val, $values); |
28
|
|
|
} |
29
|
|
|
} |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* Returns a set of matching values, either single or multiple. |
33
|
|
|
* |
34
|
|
|
* @return array |
35
|
|
|
*/ |
36
|
|
View Code Duplication |
public function matchingConfigProvider() |
37
|
|
|
{ |
38
|
|
|
return [ |
39
|
|
|
[ |
40
|
|
|
'singleValue', |
41
|
|
|
['one', 'two', 'three'], |
42
|
|
|
[123, 'nous irons au bois'], |
43
|
|
|
456, |
44
|
|
|
], |
45
|
|
|
]; |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* @covers \eZ\Publish\Core\MVC\RepositoryAware::setRepository |
50
|
|
|
* @covers \eZ\Publish\Core\MVC\Symfony\Matcher\ContentBased\MultipleValued::getRepository |
51
|
|
|
*/ |
52
|
|
|
public function testInjectRepository() |
53
|
|
|
{ |
54
|
|
|
$matcher = $this->getMultipleValuedMatcherMock(); |
55
|
|
|
$matcher->setRepository($this->repositoryMock); |
56
|
|
|
$this->assertSame($this->repositoryMock, $matcher->getRepository()); |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
private function getMultipleValuedMatcherMock() |
60
|
|
|
{ |
61
|
|
|
return $this->getMockForAbstractClass(MultipleValued::class); |
62
|
|
|
} |
63
|
|
|
} |
64
|
|
|
|
This method has been deprecated. The supplier of the class has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.