|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* File containing the URLWildcardServiceTest class. |
|
5
|
|
|
* |
|
6
|
|
|
* @copyright Copyright (C) eZ Systems AS. All rights reserved. |
|
7
|
|
|
* @license For full copyright and license information view LICENSE file distributed with this source code. |
|
8
|
|
|
*/ |
|
9
|
|
|
namespace eZ\Publish\Core\SignalSlot\Tests; |
|
10
|
|
|
|
|
11
|
|
|
use eZ\Publish\API\Repository\URLWildcardService as APIURLWildcardService; |
|
12
|
|
|
use eZ\Publish\API\Repository\Values\Content\URLWildcard; |
|
13
|
|
|
use eZ\Publish\API\Repository\Values\Content\URLWildcardTranslationResult; |
|
14
|
|
|
use eZ\Publish\Core\SignalSlot\SignalDispatcher; |
|
15
|
|
|
use eZ\Publish\Core\SignalSlot\URLWildcardService; |
|
16
|
|
|
use eZ\Publish\Core\SignalSlot\Signal\URLWildcardService as URLWildcardServiceSignals; |
|
17
|
|
|
|
|
18
|
|
|
class URLWildcardServiceTest extends ServiceTest |
|
19
|
|
|
{ |
|
20
|
|
|
protected function getServiceMock() |
|
21
|
|
|
{ |
|
22
|
|
|
return $this->createMock(APIURLWildcardService::class); |
|
23
|
|
|
} |
|
24
|
|
|
|
|
25
|
|
|
protected function getSignalSlotService($coreService, SignalDispatcher $dispatcher) |
|
26
|
|
|
{ |
|
27
|
|
|
return new URLWildcardService($coreService, $dispatcher); |
|
28
|
|
|
} |
|
29
|
|
|
|
|
30
|
|
|
public function serviceProvider() |
|
31
|
|
|
{ |
|
32
|
|
|
$wildcardId = 42; |
|
33
|
|
|
$sourceUrl = '/cms'; |
|
34
|
|
|
$destinationUrl = '/cxm'; |
|
35
|
|
|
$forward = true; |
|
36
|
|
|
$wildcard = new URLWildcard( |
|
37
|
|
|
array( |
|
38
|
|
|
'id' => $wildcardId, |
|
39
|
|
|
'sourceUrl' => $sourceUrl, |
|
40
|
|
|
'destinationUrl' => $destinationUrl, |
|
41
|
|
|
'forward' => $forward, |
|
42
|
|
|
) |
|
43
|
|
|
); |
|
44
|
|
|
|
|
45
|
|
|
return array( |
|
46
|
|
|
array( |
|
47
|
|
|
'create', |
|
48
|
|
|
array($sourceUrl, $destinationUrl, $forward), |
|
49
|
|
|
$wildcard, |
|
50
|
|
|
1, |
|
51
|
|
|
URLWildcardServiceSignals\CreateSignal::class, |
|
52
|
|
|
array('urlWildcardId' => $wildcardId), |
|
53
|
|
|
), |
|
54
|
|
|
array( |
|
55
|
|
|
'remove', |
|
56
|
|
|
array($wildcard), |
|
57
|
|
|
null, |
|
58
|
|
|
1, |
|
59
|
|
|
URLWildcardServiceSignals\RemoveSignal::class, |
|
60
|
|
|
array('urlWildcardId' => $wildcardId), |
|
61
|
|
|
), |
|
62
|
|
|
array( |
|
63
|
|
|
'load', |
|
64
|
|
|
array($wildcardId), |
|
65
|
|
|
$wildcard, |
|
66
|
|
|
0, |
|
67
|
|
|
), |
|
68
|
|
|
array( |
|
69
|
|
|
'loadAll', |
|
70
|
|
|
array(0, 1), |
|
71
|
|
|
array($wildcard), |
|
72
|
|
|
0, |
|
73
|
|
|
), |
|
74
|
|
|
array( |
|
75
|
|
|
'translate', |
|
76
|
|
|
array($sourceUrl), |
|
77
|
|
|
new URLWildcardTranslationResult( |
|
78
|
|
|
array( |
|
79
|
|
|
'uri' => $destinationUrl, |
|
80
|
|
|
'forward' => $forward, |
|
81
|
|
|
) |
|
82
|
|
|
), |
|
83
|
|
|
1, |
|
84
|
|
|
URLWildcardServiceSignals\TranslateSignal::class, |
|
85
|
|
|
array('url' => $sourceUrl), |
|
86
|
|
|
), |
|
87
|
|
|
); |
|
88
|
|
|
} |
|
89
|
|
|
} |
|
90
|
|
|
|