TYPO3 CMS  TYPO3_7-6
DependencyUtilityTest.php
Go to the documentation of this file.
1 <?php
3 
4 /*
5  * This file is part of the TYPO3 CMS project.
6  *
7  * It is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU General Public License, either version 2
9  * of the License, or any later version.
10  *
11  * For the full copyright and license information, please read the
12  * LICENSE.txt file that was distributed with this source code.
13  *
14  * The TYPO3 project - inspiring people to share!
15  */
16 
20 
26 {
30  protected $objectManagerMock;
31 
35  protected function setUp()
36  {
37  $this->objectManagerMock = $this->getMock(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface::class);
38  }
39 
44  public function checkTypo3DependencyThrowsExceptionIfVersionNumberIsTooLow()
45  {
47  $dependencyMock = $this->getMock(\TYPO3\CMS\Extensionmanager\Domain\Model\Dependency::class, ['getHighestVersion', 'getLowestVersion']);
48  $dependencyMock->expects($this->atLeastOnce())->method('getLowestVersion')->will($this->returnValue('15.0.0'));
49  $dependencyMock->setIdentifier('typo3');
50  $dependencyUtility = $this->getAccessibleMock(DependencyUtility::class, ['dummy']);
51 
52  $this->setExpectedException(\TYPO3\CMS\Extensionmanager\Exception\ExtensionManagerException::class, '', 1399144499);
53  $dependencyUtility->_call('checkTypo3Dependency', $dependencyMock);
54  }
55 
60  public function checkTypo3DependencyThrowsExceptionIfVersionNumberIsTooHigh()
61  {
63  $dependencyMock = $this->getMock(\TYPO3\CMS\Extensionmanager\Domain\Model\Dependency::class, ['getHighestVersion', 'getLowestVersion']);
64  $dependencyMock->expects($this->atLeastOnce())->method('getHighestVersion')->will($this->returnValue('3.0.0'));
65  $dependencyMock->expects($this->atLeastOnce())->method('getLowestVersion')->will($this->returnValue('1.0.0'));
66  $dependencyMock->setIdentifier('typo3');
67  $dependencyUtility = $this->getAccessibleMock(DependencyUtility::class, ['dummy']);
68 
69  $this->setExpectedException(\TYPO3\CMS\Extensionmanager\Exception\ExtensionManagerException::class, '', 1399144521);
70  $dependencyUtility->_call('checkTypo3Dependency', $dependencyMock);
71  }
72 
77  public function checkTypo3DependencyThrowsExceptionIfIdentifierIsNotTypo3()
78  {
80  $dependencyMock = $this->getMock(\TYPO3\CMS\Extensionmanager\Domain\Model\Dependency::class, ['getHighestVersion', 'getLowestVersion']);
81  $dependencyMock->setIdentifier('123');
82  $dependencyUtility = $this->getAccessibleMock(DependencyUtility::class, ['dummy']);
83 
84  $this->setExpectedException(\TYPO3\CMS\Extensionmanager\Exception\ExtensionManagerException::class, '', 1399144551);
85  $dependencyUtility->_call('checkTypo3Dependency', $dependencyMock);
86  }
87 
92  public function checkTypo3DependencyReturnsTrueIfVersionNumberIsInRange()
93  {
95  $dependencyMock = $this->getMock(\TYPO3\CMS\Extensionmanager\Domain\Model\Dependency::class, ['getHighestVersion', 'getLowestVersion']);
96  $dependencyMock->expects($this->atLeastOnce())->method('getHighestVersion')->will($this->returnValue('15.0.0'));
97  $dependencyMock->expects($this->atLeastOnce())->method('getLowestVersion')->will($this->returnValue('1.0.0'));
98  $dependencyMock->setIdentifier('typo3');
99  $dependencyUtility = $this->getAccessibleMock(DependencyUtility::class, ['dummy']);
100 
101  $this->assertTrue($dependencyUtility->_call('checkTypo3Dependency', $dependencyMock));
102  }
103 
108  public function checkTypo3DependencyCanHandleEmptyVersionHighestVersion()
109  {
111  $dependencyMock = $this->getMock(\TYPO3\CMS\Extensionmanager\Domain\Model\Dependency::class, ['getHighestVersion', 'getLowestVersion']);
112  $dependencyMock->expects($this->atLeastOnce())->method('getHighestVersion')->will($this->returnValue(''));
113  $dependencyMock->expects($this->atLeastOnce())->method('getLowestVersion')->will($this->returnValue('1.0.0'));
114  $dependencyMock->setIdentifier('typo3');
115  $dependencyUtility = $this->getAccessibleMock(DependencyUtility::class, ['dummy']);
116 
117  $this->assertTrue($dependencyUtility->_call('checkTypo3Dependency', $dependencyMock));
118  }
119 
124  public function checkTypo3DependencyCanHandleEmptyVersionLowestVersion()
125  {
127  $dependencyMock = $this->getMock(\TYPO3\CMS\Extensionmanager\Domain\Model\Dependency::class, ['getHighestVersion', 'getLowestVersion']);
128  $dependencyMock->expects($this->atLeastOnce())->method('getHighestVersion')->will($this->returnValue('15.0.0'));
129  $dependencyMock->expects($this->atLeastOnce())->method('getLowestVersion')->will($this->returnValue(''));
130  $dependencyMock->setIdentifier('typo3');
131  $dependencyUtility = $this->getAccessibleMock(DependencyUtility::class, ['dummy']);
132 
133  $this->assertTrue($dependencyUtility->_call('checkTypo3Dependency', $dependencyMock));
134  }
135 
140  public function checkPhpDependencyThrowsExceptionIfVersionNumberIsTooLow()
141  {
143  $dependencyMock = $this->getMock(\TYPO3\CMS\Extensionmanager\Domain\Model\Dependency::class, ['getHighestVersion', 'getLowestVersion']);
144  $dependencyMock->expects($this->atLeastOnce())->method('getLowestVersion')->will($this->returnValue('15.0.0'));
145  $dependencyMock->setIdentifier('php');
146  $dependencyUtility = $this->getAccessibleMock(DependencyUtility::class, ['dummy']);
147 
148  $this->setExpectedException(\TYPO3\CMS\Extensionmanager\Exception\ExtensionManagerException::class, '', 1377977857);
149  $dependencyUtility->_call('checkPhpDependency', $dependencyMock);
150  }
151 
156  public function checkPhpDependencyThrowsExceptionIfVersionNumberIsTooHigh()
157  {
159  $dependencyMock = $this->getMock(\TYPO3\CMS\Extensionmanager\Domain\Model\Dependency::class, ['getHighestVersion', 'getLowestVersion']);
160  $dependencyMock->expects($this->atLeastOnce())->method('getHighestVersion')->will($this->returnValue('3.0.0'));
161  $dependencyMock->expects($this->atLeastOnce())->method('getLowestVersion')->will($this->returnValue('1.0.0'));
162  $dependencyMock->setIdentifier('php');
163  $dependencyUtility = $this->getAccessibleMock(DependencyUtility::class, ['dummy']);
164 
165  $this->setExpectedException(\TYPO3\CMS\Extensionmanager\Exception\ExtensionManagerException::class, '', 1377977856);
166  $dependencyUtility->_call('checkPhpDependency', $dependencyMock);
167  }
168 
173  public function checkPhpDependencyThrowsExceptionIfIdentifierIsNotTypo3()
174  {
176  $dependencyMock = $this->getMock(\TYPO3\CMS\Extensionmanager\Domain\Model\Dependency::class, ['getHighestVersion', 'getLowestVersion']);
177  $dependencyMock->setIdentifier('123');
178  $dependencyUtility = $this->getAccessibleMock(DependencyUtility::class, ['dummy']);
179 
180  $this->setExpectedException(\TYPO3\CMS\Extensionmanager\Exception\ExtensionManagerException::class, '', 1377977858);
181  $dependencyUtility->_call('checkPhpDependency', $dependencyMock);
182  }
183 
188  public function checkPhpDependencyReturnsTrueIfVersionNumberIsInRange()
189  {
191  $dependencyMock = $this->getMock(\TYPO3\CMS\Extensionmanager\Domain\Model\Dependency::class, ['getHighestVersion', 'getLowestVersion']);
192  $dependencyMock->expects($this->atLeastOnce())->method('getHighestVersion')->will($this->returnValue('15.0.0'));
193  $dependencyMock->expects($this->atLeastOnce())->method('getLowestVersion')->will($this->returnValue('1.0.0'));
194  $dependencyMock->setIdentifier('php');
195  $dependencyUtility = $this->getAccessibleMock(DependencyUtility::class, ['dummy']);
196 
197  $this->assertTrue($dependencyUtility->_call('checkPhpDependency', $dependencyMock));
198  }
199 
204  public function checkPhpDependencyCanHandleEmptyVersionHighestVersion()
205  {
207  $dependencyMock = $this->getMock(\TYPO3\CMS\Extensionmanager\Domain\Model\Dependency::class, ['getHighestVersion', 'getLowestVersion']);
208  $dependencyMock->expects($this->atLeastOnce())->method('getHighestVersion')->will($this->returnValue(''));
209  $dependencyMock->expects($this->atLeastOnce())->method('getLowestVersion')->will($this->returnValue('1.0.0'));
210  $dependencyMock->setIdentifier('php');
211  $dependencyUtility = $this->getAccessibleMock(DependencyUtility::class, ['dummy']);
212 
213  $this->assertTrue($dependencyUtility->_call('checkPhpDependency', $dependencyMock));
214  }
215 
220  public function checkPhpDependencyCanHandleEmptyVersionLowestVersion()
221  {
223  $dependencyMock = $this->getMock(\TYPO3\CMS\Extensionmanager\Domain\Model\Dependency::class, ['getHighestVersion', 'getLowestVersion']);
224  $dependencyMock->expects($this->atLeastOnce())->method('getHighestVersion')->will($this->returnValue('15.0.0'));
225  $dependencyMock->expects($this->atLeastOnce())->method('getLowestVersion')->will($this->returnValue(''));
226  $dependencyMock->setIdentifier('php');
227  $dependencyUtility = $this->getAccessibleMock(DependencyUtility::class, ['dummy']);
228 
229  $this->assertTrue($dependencyUtility->_call('checkPhpDependency', $dependencyMock));
230  }
231 
236  public function checkDependenciesCallsMethodToCheckPhpDependencies()
237  {
239  $extensionMock = $this->getMock(Extension::class, ['dummy']);
241  $dependencyMock = $this->getMock(\TYPO3\CMS\Extensionmanager\Domain\Model\Dependency::class, ['getHighestVersion', 'getLowestVersion']);
242  $dependencyMock->setIdentifier('php');
243  $dependencyStorage = new \SplObjectStorage();
244  $dependencyStorage->attach($dependencyMock);
245  $extensionMock->setDependencies($dependencyStorage);
247  $dependencyUtility = $this->getMock(DependencyUtility::class, ['checkPhpDependency', 'checkTypo3Dependency']);
248  $dependencyUtility->expects($this->atLeastOnce())->method('checkPhpDependency');
249  $dependencyUtility->checkDependencies($extensionMock);
250  }
251 
256  public function checkDependenciesCallsMethodToCheckTypo3Dependencies()
257  {
259  $extensionMock = $this->getMock(Extension::class, ['dummy']);
261  $dependencyMock = $this->getMock(\TYPO3\CMS\Extensionmanager\Domain\Model\Dependency::class, ['getHighestVersion', 'getLowestVersion']);
262  $dependencyMock->setIdentifier('typo3');
263  $dependencyStorage = new \SplObjectStorage();
264  $dependencyStorage->attach($dependencyMock);
265  $extensionMock->setDependencies($dependencyStorage);
267  $dependencyUtility = $this->getMock(DependencyUtility::class, ['checkPhpDependency', 'checkTypo3Dependency']);
268 
269  $dependencyUtility->expects($this->atLeastOnce())->method('checkTypo3Dependency');
270  $dependencyUtility->checkDependencies($extensionMock);
271  }
272 
277  public function isVersionCompatibleReturnsTrueForCompatibleVersion()
278  {
280  $dependencyMock = $this->getMock(\TYPO3\CMS\Extensionmanager\Domain\Model\Dependency::class, ['getHighestVersion', 'getLowestVersion']);
281  $dependencyMock->expects($this->atLeastOnce())->method('getHighestVersion')->will($this->returnValue('15.0.0'));
282  $dependencyMock->expects($this->atLeastOnce())->method('getLowestVersion')->will($this->returnValue('1.0.0'));
283  $version = '3.3.3';
284  $dependencyUtility = $this->getAccessibleMock(DependencyUtility::class, ['dummy']);
285 
286  $this->assertTrue($dependencyUtility->_call('isVersionCompatible', $version, $dependencyMock));
287  }
288 
293  public function isVersionCompatibleReturnsFalseForIncompatibleVersion()
294  {
296  $dependencyMock = $this->getMock(\TYPO3\CMS\Extensionmanager\Domain\Model\Dependency::class, ['getHighestVersion', 'getLowestVersion']);
297  $dependencyMock->expects($this->atLeastOnce())->method('getHighestVersion')->will($this->returnValue('1.0.1'));
298  $dependencyMock->expects($this->atLeastOnce())->method('getLowestVersion')->will($this->returnValue('1.0.0'));
299  $version = '3.3.3';
300  $dependencyUtility = $this->getAccessibleMock(DependencyUtility::class, ['dummy']);
301 
302  $this->assertFalse($dependencyUtility->_call('isVersionCompatible', $version, $dependencyMock));
303  }
304 
310  {
311  $availableExtensions = [
312  'dummy' => [],
313  'foo' => [],
314  'bar' => []
315  ];
316  $listUtilityMock = $this->getMock(\TYPO3\CMS\Extensionmanager\Utility\ListUtility::class, ['getAvailableExtensions']);
317  $listUtilityMock->expects($this->atLeastOnce())->method('getAvailableExtensions')->will($this->returnValue($availableExtensions));
318  $dependencyUtility = $this->getAccessibleMock(DependencyUtility::class, ['dummy']);
319  $dependencyUtility->_set('listUtility', $listUtilityMock);
320 
321  $this->assertTrue($dependencyUtility->_call('isDependentExtensionAvailable', 'dummy'));
322  }
323 
329  {
330  $availableExtensions = [
331  'dummy' => [],
332  'foo' => [],
333  'bar' => []
334  ];
335  $listUtilityMock = $this->getMock(\TYPO3\CMS\Extensionmanager\Utility\ListUtility::class, ['getAvailableExtensions']);
336  $listUtilityMock->expects($this->atLeastOnce())->method('getAvailableExtensions')->will($this->returnValue($availableExtensions));
337  $dependencyUtility = $this->getAccessibleMock(DependencyUtility::class, ['dummy']);
338  $dependencyUtility->_set('listUtility', $listUtilityMock);
339 
340  $this->assertFalse($dependencyUtility->_call('isDependentExtensionAvailable', '42'));
341  }
342 
348  {
349  $emConfUtility = $this->getMock(\TYPO3\CMS\Extensionmanager\Utility\EmConfUtility::class, ['includeEmConf']);
350  $emConfUtility->expects($this->once())->method('includeEmConf')->will($this->returnValue([
351  'key' => 'dummy',
352  'version' => '1.0.0'
353  ]));
354  $dependencyUtility = $this->getAccessibleMock(DependencyUtility::class, ['setAvailableExtensions', 'isVersionCompatible']);
355  $dependencyMock = $this->getMock(\TYPO3\CMS\Extensionmanager\Domain\Model\Dependency::class, ['getIdentifier']);
356  $dependencyMock->expects($this->once())->method('getIdentifier')->will($this->returnValue('dummy'));
357  $dependencyUtility->_set('emConfUtility', $emConfUtility);
358  $dependencyUtility->_set('availableExtensions', [
359  'dummy' => [
360  'foo' => '42'
361  ]
362  ]);
363  $dependencyUtility->expects($this->once())->method('setAvailableExtensions');
364  $dependencyUtility->expects($this->once())->method('isVersionCompatible')->with('1.0.0', $this->anything());
365  $dependencyUtility->_call('isAvailableVersionCompatible', $dependencyMock);
366  }
367 
373  {
374  $extensionRepositoryMock = $this->getMock(\TYPO3\CMS\Extensionmanager\Domain\Repository\ExtensionRepository::class, ['countByExtensionKey'], [$this->objectManagerMock]);
375  $extensionRepositoryMock->expects($this->once())->method('countByExtensionKey')->with('test123')->will($this->returnValue(1));
376  $dependencyUtility = $this->getAccessibleMock(DependencyUtility::class, ['dummy']);
377  $dependencyUtility->_set('extensionRepository', $extensionRepositoryMock);
378  $count = $dependencyUtility->_call('isExtensionDownloadableFromTer', 'test123');
379 
380  $this->assertTrue($count);
381  }
382 
388  {
389  $extensionRepositoryMock = $this->getMock(\TYPO3\CMS\Extensionmanager\Domain\Repository\ExtensionRepository::class, ['countByExtensionKey'], [$this->objectManagerMock]);
390  $extensionRepositoryMock->expects($this->once())->method('countByExtensionKey')->with('test123')->will($this->returnValue(0));
391  $dependencyUtility = $this->getAccessibleMock(DependencyUtility::class, ['dummy']);
392  $dependencyUtility->_set('extensionRepository', $extensionRepositoryMock);
393  $count = $dependencyUtility->_call('isExtensionDownloadableFromTer', 'test123');
394 
395  $this->assertFalse($count);
396  }
397 
403  {
404  $dependencyMock = $this->getMock(\TYPO3\CMS\Extensionmanager\Domain\Model\Dependency::class, ['getIdentifier', 'getHighestVersion', 'getLowestVersion']);
405  $dependencyMock->expects($this->once())->method('getIdentifier')->will($this->returnValue('dummy'));
406  $dependencyMock->expects($this->once())->method('getHighestVersion')->will($this->returnValue('10.0.0'));
407  $dependencyMock->expects($this->once())->method('getLowestVersion')->will($this->returnValue('1.0.0'));
408  $extensionRepositoryMock = $this->getMock(\TYPO3\CMS\Extensionmanager\Domain\Repository\ExtensionRepository::class, ['countByVersionRangeAndExtensionKey'], [$this->objectManagerMock]);
409  $extensionRepositoryMock->expects($this->once())->method('countByVersionRangeAndExtensionKey')->with('dummy', 1000000, 10000000)->will($this->returnValue(2));
410  $dependencyUtility = $this->getAccessibleMock(DependencyUtility::class, ['dummy']);
411  $dependencyUtility->_set('extensionRepository', $extensionRepositoryMock);
412  $count = $dependencyUtility->_call('isDownloadableVersionCompatible', $dependencyMock);
413 
414  $this->assertTrue($count);
415  }
416 
422  {
423  $dependencyMock = $this->getMock(\TYPO3\CMS\Extensionmanager\Domain\Model\Dependency::class, ['getIdentifier']);
424  $dependencyMock->expects($this->once())->method('getIdentifier')->will($this->returnValue('dummy'));
425  $extensionRepositoryMock = $this->getMock(\TYPO3\CMS\Extensionmanager\Domain\Repository\ExtensionRepository::class, ['countByVersionRangeAndExtensionKey'], [$this->objectManagerMock]);
426  $extensionRepositoryMock->expects($this->once())->method('countByVersionRangeAndExtensionKey')->with('dummy', 1000000, 2000000)->will($this->returnValue(0));
427  $dependencyUtility = $this->getAccessibleMock(DependencyUtility::class, ['getLowestAndHighestIntegerVersions']);
428  $dependencyUtility->_set('extensionRepository', $extensionRepositoryMock);
429  $dependencyUtility->expects($this->once())->method('getLowestAndHighestIntegerVersions')->will($this->returnValue([
430  'lowestIntegerVersion' => 1000000,
431  'highestIntegerVersion' => 2000000
432  ]));
433  $count = $dependencyUtility->_call('isDownloadableVersionCompatible', $dependencyMock);
434 
435  $this->assertFalse($count);
436  }
437 
443  {
444  $expectedVersions = [
445  'lowestIntegerVersion' => 1000000,
446  'highestIntegerVersion' => 2000000
447  ];
448 
449  $dependencyMock = $this->getMock(\TYPO3\CMS\Extensionmanager\Domain\Model\Dependency::class, ['getHighestVersion', 'getLowestVersion']);
450  $dependencyMock->expects($this->once())->method('getHighestVersion')->will($this->returnValue('2.0.0'));
451  $dependencyMock->expects($this->once())->method('getLowestVersion')->will($this->returnValue('1.0.0'));
452  $dependencyUtility = $this->getAccessibleMock(DependencyUtility::class, ['dummy']);
453  $versions = $dependencyUtility->_call('getLowestAndHighestIntegerVersions', $dependencyMock);
454 
455  $this->assertSame($expectedVersions, $versions);
456  }
457 
463  {
464  $extension1 = new Extension();
465  $extension1->setExtensionKey('foo');
466  $extension1->setVersion('1.0.0');
467  $extension2 = new Extension();
468  $extension2->setExtensionKey('bar');
469  $extension2->setVersion('1.0.42');
470 
471  $myStorage = new \TYPO3\CMS\Extensionmanager\Tests\Unit\Fixtures\LatestCompatibleExtensionObjectStorageFixture();
472  $myStorage->extensions[] = $extension1;
473  $myStorage->extensions[] = $extension2;
474  $dependencyMock = $this->getMock(\TYPO3\CMS\Extensionmanager\Domain\Model\Dependency::class, ['getIdentifier']);
475  $dependencyMock->expects($this->once())->method('getIdentifier')->will($this->returnValue('foobar'));
476  $dependencyUtility = $this->getAccessibleMock(DependencyUtility::class, ['getLowestAndHighestIntegerVersions']);
477  $dependencyUtility->expects($this->once())->method('getLowestAndHighestIntegerVersions')->will($this->returnValue([
478  'lowestIntegerVersion' => 1000000,
479  'highestIntegerVersion' => 2000000
480  ]));
481  $extensionRepositoryMock = $this->getMock(\TYPO3\CMS\Extensionmanager\Domain\Repository\ExtensionRepository::class, ['findByVersionRangeAndExtensionKeyOrderedByVersion'], [$this->objectManagerMock]);
482  $extensionRepositoryMock->expects($this->once())->method('findByVersionRangeAndExtensionKeyOrderedByVersion')->with('foobar', 1000000, 2000000)->will($this->returnValue($myStorage));
483  $dependencyUtility->_set('extensionRepository', $extensionRepositoryMock);
484  $extension = $dependencyUtility->_call('getLatestCompatibleExtensionByIntegerVersionDependency', $dependencyMock);
485 
486  $this->assertInstanceOf(Extension::class, $extension);
487  $this->assertSame('foo', $extension->getExtensionKey());
488  }
489 
494  {
495  // foo2 should be kept
496  $foo1 = new Extension();
497  $foo1->setExtensionKey('foo');
498  $foo1->setVersion('1.0.0');
499  $foo2 = new Extension();
500  $foo2->setExtensionKey('foo');
501  $foo2->setVersion('1.0.1');
502 
503  // bar1 should be kept
504  $bar1 = new Extension();
505  $bar1->setExtensionKey('bar');
506  $bar1->setVersion('1.1.2');
507  $bar2 = new Extension();
508  $bar2->setExtensionKey('bar');
509  $bar2->setVersion('1.1.1');
510  $bar3 = new Extension();
511  $bar3->setExtensionKey('bar');
512  $bar3->setVersion('1.0.3');
513 
514  $input = [$foo1, $foo2, $bar1, $bar2, $bar3];
515  $this->assertEquals(['foo' => $foo2, 'bar' => $bar1], (new DependencyUtility())->filterYoungestVersionOfExtensionList($input, true));
516  }
517 
522  {
523  $suitableDependency = new Dependency();
524  $suitableDependency->setIdentifier('typo3');
525  $suitableDependency->setLowestVersion('3.6.1');
526 
527  $suitableDependencies = new \SplObjectStorage();
528  $suitableDependencies->attach($suitableDependency);
529 
530  $unsuitableDependency = new Dependency();
531  $unsuitableDependency->setIdentifier('typo3');
532  $unsuitableDependency->setHighestVersion('4.3.0');
533 
534  $unsuitableDependencies = new \SplObjectStorage();
535  $unsuitableDependencies->attach($unsuitableDependency);
536 
537  // foo1 should be kept
538  $foo1 = new Extension();
539  $foo1->setExtensionKey('foo');
540  $foo1->setVersion('1.0.0');
541  $foo1->setDependencies($suitableDependencies);
542 
543  $foo2 = new Extension();
544  $foo2->setExtensionKey('foo');
545  $foo2->setVersion('1.0.1');
546  $foo2->setDependencies($unsuitableDependencies);
547 
548  // bar2 should be kept
549  $bar1 = new Extension();
550  $bar1->setExtensionKey('bar');
551  $bar1->setVersion('1.1.2');
552  $bar1->setDependencies($unsuitableDependencies);
553 
554  $bar2 = new Extension();
555  $bar2->setExtensionKey('bar');
556  $bar2->setVersion('1.1.1');
557  $bar2->setDependencies($suitableDependencies);
558 
559  $input = [$foo1, $foo2, $bar1, $bar2];
560  $this->assertEquals(['foo' => $foo1, 'bar' => $bar2], (new DependencyUtility())->filterYoungestVersionOfExtensionList($input, false));
561  }
562 }
getAccessibleMock( $originalClassName, $methods=[], array $arguments=[], $mockClassName='', $callOriginalConstructor=true, $callOriginalClone=true, $callAutoload=true)