‪TYPO3CMS  9.5
UpdateExtensionListTaskTest.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 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
21 
25 class ‪UpdateExtensionListTaskTest extends UnitTestCase
26 {
30  protected ‪$resetSingletonInstances = true;
31 
36  {
37  $taskMock = $this->getMockBuilder(UpdateExtensionListTask::class)->disableOriginalConstructor()->getMock();
38  self::assertInstanceOf(AbstractTask::class, $taskMock);
39  }
40 
45  {
46  $repositoryHelper = $this->createMock(Helper::class);
47  $repositoryHelper
48  ->expects($this->once())
49  ->method('updateExtList');
50 
51  $objectManagerMock = $this->createMock(\‪TYPO3\CMS\‪Extbase\Object\ObjectManager::class);
52  $objectManagerMock
53  ->expects($this->at(0))
54  ->method('get')
55  ->with(Helper::class)
56  ->will($this->returnValue($repositoryHelper));
57 
58  $persistenceManagerMock = $this->getMockBuilder(\‪TYPO3\CMS\‪Extbase\Persistence\Generic\PersistenceManager::class)->getMock();
59  $objectManagerMock
60  ->expects($this->at(1))
61  ->method('get')
62  ->will($this->returnValue($persistenceManagerMock));
63 
64  \TYPO3\CMS\Core\Utility\GeneralUtility::setSingletonInstance(\‪TYPO3\CMS\‪Extbase\Object\ObjectManager::class, $objectManagerMock);
65 
66  $task = $this->getMockBuilder(UpdateExtensionListTask::class)
67  ->setMethods(['dummy'])
68  ->disableOriginalConstructor()
69  ->getMock();
70  $task->execute();
71  }
72 
77  {
78  $repositoryHelper = $this->createMock(Helper::class);
79  $objectManagerMock = $this->createMock(\‪TYPO3\CMS\‪Extbase\Object\ObjectManager::class);
80  $objectManagerMock
81  ->expects($this->at(0))
82  ->method('get')
83  ->with(Helper::class)
84  ->will($this->returnValue($repositoryHelper));
85 
86  $persistenceManagerMock = $this->getMockBuilder(\‪TYPO3\CMS\‪Extbase\Persistence\Generic\PersistenceManager::class)->getMock();
87  $persistenceManagerMock
88  ->expects($this->once())
89  ->method('persistAll');
90 
91  $objectManagerMock
92  ->expects($this->at(1))
93  ->method('get')
94  ->will($this->returnValue($persistenceManagerMock));
95 
96  \TYPO3\CMS\Core\Utility\GeneralUtility::setSingletonInstance(\‪TYPO3\CMS\‪Extbase\Object\ObjectManager::class, $objectManagerMock);
97 
99  $task = $this->getMockBuilder(UpdateExtensionListTask::class)
100  ->setMethods(['dummy'])
101  ->disableOriginalConstructor()
102  ->getMock();
103  $task->execute();
104  }
105 }
‪TYPO3\CMS\Extensionmanager\Tests\Unit\Task\UpdateExtensionListTaskTest\executeCallsPersistAllOnPersistenceManager
‪executeCallsPersistAllOnPersistenceManager()
Definition: UpdateExtensionListTaskTest.php:75
‪TYPO3\CMS\Extensionmanager\Tests\Unit\Task\UpdateExtensionListTaskTest\executeCallsUpdateExtListOfRepositoryHelper
‪executeCallsUpdateExtListOfRepositoryHelper()
Definition: UpdateExtensionListTaskTest.php:43
‪TYPO3\CMS\Extbase\Annotation
Definition: IgnoreValidation.php:4
‪TYPO3
‪TYPO3\CMS\Extensionmanager\Tests\Unit\Task\UpdateExtensionListTaskTest\updateExtensionListTaskIsInstanceOfAbstractTask
‪updateExtensionListTaskIsInstanceOfAbstractTask()
Definition: UpdateExtensionListTaskTest.php:34
‪TYPO3\CMS\Extensionmanager\Task\UpdateExtensionListTask
Definition: UpdateExtensionListTask.php:22
‪TYPO3\CMS\Extensionmanager\Tests\Unit\Task
Definition: UpdateExtensionListTaskTest.php:2
‪TYPO3\CMS\Scheduler\Task\AbstractTask
Definition: AbstractTask.php:32
‪TYPO3\CMS\Extensionmanager\Tests\Unit\Task\UpdateExtensionListTaskTest\$resetSingletonInstances
‪bool $resetSingletonInstances
Definition: UpdateExtensionListTaskTest.php:29
‪TYPO3\CMS\Extensionmanager\Tests\Unit\Task\UpdateExtensionListTaskTest
Definition: UpdateExtensionListTaskTest.php:26
‪TYPO3\CMS\Extensionmanager\Utility\Repository\Helper
Definition: Helper.php:34