2 namespace TYPO3\CMS\Workspaces\Tests\Unit\ExtDirect;
17 use Prophecy\Argument;
18 use Prophecy\Prophecy\ObjectProphecy;
46 $this->subject = $this->getAccessibleMock(\TYPO3\CMS\Workspaces\ExtDirect\ExtDirectServer::class, array(
'__none'));
54 unset($this->subject);
55 unset($this->fileReferenceProphecies);
64 'unchanged wo/thumbnails' => array(
'1,2,3,4',
'1,2,3,4',
false, null),
65 'front addition wo/thumbnails' => array(
'1,2,3,4',
'99,1,2,3,4',
false, array(
66 'live' =>
'/img/1.png /img/2.png /img/3.png /img/4.png',
67 'differences' =>
'<ins>/img/99.png </ins>/img/1.png /img/2.png /img/3.png /img/4.png',
69 'end addition wo/thumbnails' => array(
'1,2,3,4',
'1,2,3,4,99',
false, array(
70 'live' =>
'/img/1.png /img/2.png /img/3.png /img/4.png',
71 'differences' =>
'/img/1.png /img/2.png /img/3.png /img/4.png <ins>/img/99.png </ins>',
73 'reorder wo/thumbnails' => array(
'1,2,3,4',
'1,3,2,4',
false, array(
74 'live' =>
'/img/1.png /img/2.png /img/3.png /img/4.png',
75 'differences' =>
'/img/1.png <ins>/img/3.png </ins>/img/2.png <del>/img/3.png </del>/img/4.png',
77 'move to end wo/thumbnails' => array(
'1,2,3,4',
'2,3,4,1',
false, array(
78 'live' =>
'/img/1.png /img/2.png /img/3.png /img/4.png',
79 'differences' =>
'<del>/img/1.png </del>/img/2.png /img/3.png /img/4.png <ins>/img/1.png </ins>',
81 'move to front wo/thumbnails' => array(
'1,2,3,4',
'4,1,2,3',
false, array(
82 'live' =>
'/img/1.png /img/2.png /img/3.png /img/4.png',
83 'differences' =>
'<ins>/img/4.png </ins>/img/1.png /img/2.png /img/3.png <del>/img/4.png </del>',
85 'keep last wo/thumbnails' => array(
'1,2,3,4',
'4',
false, array(
86 'live' =>
'/img/1.png /img/2.png /img/3.png /img/4.png',
87 'differences' =>
'<del>/img/1.png /img/2.png /img/3.png </del>/img/4.png',
90 'unchanged w/thumbnails' => array(
'1,2,3,4',
'1,2,3,4',
true, null),
91 'front addition w/thumbnails' => array(
'1,2,3,4',
'99,1,2,3,4',
true, array(
92 'live' =>
'<img src="/tmb/1.png" /> <img src="/tmb/2.png" /> <img src="/tmb/3.png" /> <img src="/tmb/4.png" />',
93 'differences' =>
'<ins><img src="/tmb/99.png" /> </ins><img src="/tmb/1.png" /> <img src="/tmb/2.png" /> <img src="/tmb/3.png" /> <img src="/tmb/4.png" />',
95 'end addition w/thumbnails' => array(
'1,2,3,4',
'1,2,3,4,99',
true, array(
96 'live' =>
'<img src="/tmb/1.png" /> <img src="/tmb/2.png" /> <img src="/tmb/3.png" /> <img src="/tmb/4.png" />',
97 'differences' =>
'<img src="/tmb/1.png" /> <img src="/tmb/2.png" /> <img src="/tmb/3.png" /> <img src="/tmb/4.png" /> <ins><img src="/tmb/99.png" /> </ins>',
99 'reorder w/thumbnails' => array(
'1,2,3,4',
'1,3,2,4',
true, array(
100 'live' =>
'<img src="/tmb/1.png" /> <img src="/tmb/2.png" /> <img src="/tmb/3.png" /> <img src="/tmb/4.png" />',
101 'differences' =>
'<img src="/tmb/1.png" /> <ins><img src="/tmb/3.png" /> </ins><img src="/tmb/2.png" /> <del><img src="/tmb/3.png" /> </del><img src="/tmb/4.png" />',
103 'move to end w/thumbnails' => array(
'1,2,3,4',
'2,3,4,1',
true, array(
104 'live' =>
'<img src="/tmb/1.png" /> <img src="/tmb/2.png" /> <img src="/tmb/3.png" /> <img src="/tmb/4.png" />',
105 'differences' =>
'<del><img src="/tmb/1.png" /> </del><img src="/tmb/2.png" /> <img src="/tmb/3.png" /> <img src="/tmb/4.png" /> <ins><img src="/tmb/1.png" /> </ins>',
107 'move to front w/thumbnails' => array(
'1,2,3,4',
'4,1,2,3',
true, array(
108 'live' =>
'<img src="/tmb/1.png" /> <img src="/tmb/2.png" /> <img src="/tmb/3.png" /> <img src="/tmb/4.png" />',
109 'differences' =>
'<ins><img src="/tmb/4.png" /> </ins><img src="/tmb/1.png" /> <img src="/tmb/2.png" /> <img src="/tmb/3.png" /> <del><img src="/tmb/4.png" /> </del>',
111 'keep last w/thumbnails' => array(
'1,2,3,4',
'4',
true, array(
112 'live' =>
'<img src="/tmb/1.png" /> <img src="/tmb/2.png" /> <img src="/tmb/3.png" /> <img src="/tmb/4.png" />',
113 'differences' =>
'<del><img src="/tmb/1.png" /> <img src="/tmb/2.png" /> <img src="/tmb/3.png" /> </del><img src="/tmb/4.png" />',
130 $result = $this->subject->_call(
131 'prepareFileReferenceDifferences',
133 $versionFileReferences,
137 $this->assertSame($expected, $result);
148 foreach ($ids as $id) {
160 if (isset($this->fileReferenceProphecies[$id])) {
161 return $this->fileReferenceProphecies[$id];
164 $processedFileProphecy = $this->prophesize(ProcessedFile::class);
165 $processedFileProphecy->getPublicUrl(Argument::cetera())->willReturn(
'/tmb/' . $id .
'.png');
167 $fileProphecy = $this->prophesize(File::class);
168 $fileProphecy->process(Argument::cetera())->willReturn($processedFileProphecy->reveal());
170 $fileReferenceProphecy = $this->prophesize(FileReference::class);
171 $fileReferenceProphecy->getUid()->willReturn($id);
172 $fileReferenceProphecy->getOriginalFile()->willReturn($fileProphecy->reveal());
173 $fileReferenceProphecy->getPublicUrl(Argument::cetera())->willReturn(
'/img/' . $id .
'.png');
175 $this->fileReferenceProphecies[$id] = $fileReferenceProphecy->reveal();
176 return $this->fileReferenceProphecies[$id];