diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 76c6a85..164e96f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -6,24 +6,9 @@ jobs: strategy: fail-fast: false matrix: - php: ["7.2", "7.3", "7.4"] - typo3: ["^10.4"] + php: ["8.1", "8.2"] + typo3: ["^12.4"] continue-on-error: [false] - include: - - php: "7.4" - coverage: "1" - - php: "8.0" - typo3: "^10.4" - continue-on-error: true - - php: "7.4" - typo3: "^11.5" - continue-on-error: false - - php: "8.0" - typo3: "^11.5" - continue-on-error: false - - php: "8.1" - typo3: "^11.5" - continue-on-error: false continue-on-error: ${{ matrix.continue-on-error }} env: TYPO3_VERSION: ${{ matrix.typo3 }} diff --git a/Classes/Command/ImportCommandController.php b/Classes/Command/ImportCommandController.php index 49fb400..228d0f7 100644 --- a/Classes/Command/ImportCommandController.php +++ b/Classes/Command/ImportCommandController.php @@ -10,11 +10,10 @@ use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; +use TYPO3\CMS\Core\Messaging\AbstractMessage; use TYPO3\CMS\Core\Messaging\FlashMessage; use TYPO3\CMS\Core\Messaging\FlashMessageService; use TYPO3\CMS\Core\Utility\GeneralUtility; -use TYPO3\CMS\Extbase\Object\ObjectManager; - /** * ImportCommandController * @@ -23,11 +22,6 @@ class ImportCommandController extends Command { - /** - * @var object|\Psr\Log\LoggerAwareInterface|\TYPO3\CMS\Core\SingletonInterface|ObjectManager - */ - protected $objectManager; - /** * ImportCommandController constructor. * @param string|null $name @@ -35,8 +29,6 @@ class ImportCommandController extends Command public function __construct(string $name = null) { parent::__construct($name); - - $this->objectManager = GeneralUtility::makeInstance(ObjectManager::class); } /** @@ -64,11 +56,11 @@ public function initializeServiceManagerCommand($mail = null) FlashMessage::class, '', 'Initializing ServiceManager', - FlashMessage::INFO + \TYPO3\CMS\Core\Type\ContextualFeedbackSeverity::INFO ); $this->addFlashMessage($message); - $manager = $this->objectManager->get(Manager::class); + $manager = GeneralUtility::makeInstance(Manager::class); try { // let the manager run the imports now $manager->runImports(); @@ -77,7 +69,7 @@ public function initializeServiceManagerCommand($mail = null) FlashMessage::class, '', 'An Error occured: ' . $e->getCode() . ': ' . $e->getMessage(), - FlashMessage::ERROR + \TYPO3\CMS\Core\Type\ContextualFeedbackSeverity::ERROR ); $this->addFlashMessage($message); diff --git a/Classes/Controller/ImportrController.php b/Classes/Controller/ImportrController.php index c009098..d48b89b 100644 --- a/Classes/Controller/ImportrController.php +++ b/Classes/Controller/ImportrController.php @@ -10,6 +10,7 @@ use HDNET\Importr\Domain\Repository\StrategyRepository; use HDNET\Importr\Service\ImportServiceInterface; use HDNET\Importr\Service\Manager; +use Psr\Http\Message\ResponseInterface; use TYPO3\CMS\Core\Messaging\FlashMessage; use TYPO3\CMS\Core\Messaging\FlashMessageService; use TYPO3\CMS\Core\Resource\ResourceFactory; @@ -62,7 +63,7 @@ public function __construct( $this->importService = $importService; } - public function indexAction() + public function indexAction():ResponseInterface { $combinedIdentifier = GeneralUtility::_GP('id'); if (isset($combinedIdentifier) && \is_string($combinedIdentifier)) { @@ -75,23 +76,26 @@ public function indexAction() $this->view->assign('folder', $files); } $this->view->assign('imports', $this->importRepository->findUserQueue()); + + return $this->htmlResponse($this->view->render()); } /** * @param string $identifier */ - public function importAction($identifier) + public function importAction($identifier):ResponseInterface { $file = $this->resourceFactory->getObjectFromCombinedIdentifier($identifier); $this->view->assign('file', $file); $this->view->assign('strategies', $this->strategyRepository->findAllUser()); + return $this->htmlResponse($this->view->render()); } /** * @param string $identifier * @param \HDNET\Importr\Domain\Model\Strategy $strategy */ - public function previewAction($identifier, Strategy $strategy) + public function previewAction($identifier, Strategy $strategy):ResponseInterface { $file = $this->resourceFactory->getObjectFromCombinedIdentifier($identifier); $this->view->assign('filepath', $file->getPublicUrl()); @@ -99,13 +103,14 @@ public function previewAction($identifier, Strategy $strategy) $previewData = $this->importManager->getPreview($strategy, $file->getPublicUrl()); $this->view->assign('preview', $previewData); + return $this->htmlResponse($this->view->render()); } /** * @param string $filepath * @param \HDNET\Importr\Domain\Model\Strategy $strategy */ - public function createAction($filepath, Strategy $strategy) + public function createAction($filepath, Strategy $strategy):ResponseInterface { $this->importService->addToQueue($filepath, $strategy); $text = 'The Import file %s width the strategy %s was successfully added to the queue'; @@ -117,22 +122,22 @@ public function createAction($filepath, Strategy $strategy) true ); - $flashMessageService = $this->objectManager->get( + $flashMessageService = GeneralUtility::makeInstance( FlashMessageService::class ); $messageQueue = $flashMessageService->getMessageQueueByIdentifier(); $messageQueue->addMessage($message); - $this->redirect('index'); + return $this->redirect('index'); } /** * @param Import $import */ - public function resetAction(Import $import) + public function resetAction(Import $import):ResponseInterface { $import->reset(); $this->importRepository->update($import); - $this->redirect('index'); + return $this->redirect('index'); } } diff --git a/Classes/Domain/Repository/ImportRepository.php b/Classes/Domain/Repository/ImportRepository.php index 5a141b3..ba4eadc 100644 --- a/Classes/Domain/Repository/ImportRepository.php +++ b/Classes/Domain/Repository/ImportRepository.php @@ -31,7 +31,7 @@ public function findUserQueue($days = 7) $query->greaterThan('starttime', \time() - 60 * 60 * 24 * $days) ]; - $query->matching($query->logicalAnd($conditions)); + $query->matching($query->logicalAnd(...$conditions)); $query->setOrderings(['starttime' => Query::ORDER_DESCENDING]); @@ -52,7 +52,7 @@ public function findWorkQueue() $query->lessThan('endtime', 1), ]; - $query->matching($query->logicalAnd($conditions)); + $query->matching($query->logicalAnd(...$conditions)); $query->setOrderings(['starttime' => Query::ORDER_ASCENDING]); diff --git a/Classes/Feature/FeatureRegistry.php b/Classes/Feature/FeatureRegistry.php index a9bbb11..94087d6 100644 --- a/Classes/Feature/FeatureRegistry.php +++ b/Classes/Feature/FeatureRegistry.php @@ -8,7 +8,6 @@ use HDNET\Importr\Service\Manager; use TYPO3\CMS\Core\Utility\GeneralUtility; -use TYPO3\CMS\Extbase\SignalSlot\Dispatcher; /** * Class FeatureRegistry @@ -21,7 +20,6 @@ class FeatureRegistry */ public static function enable($names, $class = Manager::class) { - $dispatcher = GeneralUtility::makeInstance(Dispatcher::class); if (!\is_array($names)) { $names = [$names]; } @@ -30,7 +28,8 @@ public static function enable($names, $class = Manager::class) $caller = $trace[1]['class']; foreach ($names as $name) { - $dispatcher->connect($class, $name, $caller, 'execute'); + // @todo migrate to events + // $dispatcher->connect($class, $name, $caller, 'execute'); } } } diff --git a/Classes/Processor/Configuration.php b/Classes/Processor/Configuration.php index 0e608c7..a94404c 100644 --- a/Classes/Processor/Configuration.php +++ b/Classes/Processor/Configuration.php @@ -9,17 +9,13 @@ use HDNET\Importr\Exception\ReinitializeException; use HDNET\Importr\Service\ImportServiceInterface; use HDNET\Importr\Service\ManagerInterface; -use TYPO3\CMS\Extbase\SignalSlot\Dispatcher; +use Psr\EventDispatcher\EventDispatcherInterface; /** * Configuration */ class Configuration { - /** - * @var Dispatcher - */ - protected $dispatcher; /** * @var StrategyRepository @@ -34,13 +30,11 @@ class Configuration /** * Configuration constructor. * - * @param Dispatcher $dispatcher * @param StrategyRepository $strategyRepository * @param ImportServiceInterface $importService */ - public function __construct(Dispatcher $dispatcher, StrategyRepository $strategyRepository, ImportServiceInterface $importService) + public function __construct(protected EventDispatcherInterface $eventDispatcher, StrategyRepository $strategyRepository, ImportServiceInterface $importService) { - $this->dispatcher = $dispatcher; $this->strategyRepository = $strategyRepository; $this->importService = $importService; } @@ -106,11 +100,13 @@ protected function processInner(array $configuration, ManagerInterface $manager) */ protected function emitSignal($name, array &$configuration) { - $this->dispatcher->dispatch( - __CLASS__, - $name, - [$this, $configuration] - ); + + // @todo migrate to events + #$this->dispatcher->dispatch( + # __CLASS__, + # $name, + # [$this, $configuration] + #); } /** diff --git a/Classes/Processor/Target.php b/Classes/Processor/Target.php index df6580a..6776b37 100644 --- a/Classes/Processor/Target.php +++ b/Classes/Processor/Target.php @@ -7,7 +7,7 @@ use HDNET\Importr\Domain\Model\Import; use HDNET\Importr\Service\ImportServiceInterface; use HDNET\Importr\Service\Targets\TargetInterface; -use TYPO3\CMS\Extbase\SignalSlot\Dispatcher; +use Psr\EventDispatcher\EventDispatcherInterface; /** * Target @@ -19,21 +19,14 @@ class Target */ protected $importService; - /** - * @var Dispatcher - */ - protected $dispatcher; - /** * Target constructor. * * @param ImportServiceInterface $importService - * @param Dispatcher $dispatcher */ - public function __construct(ImportServiceInterface $importService, Dispatcher $dispatcher) + public function __construct(ImportServiceInterface $importService, protected EventDispatcherInterface $dispatcher) { $this->importService = $importService; - $this->dispatcher = $dispatcher; } /** @@ -66,11 +59,12 @@ public function process(TargetInterface $target, $entry, Import $import, $pointe */ protected function emitEntrySignal($name, array $configuration, $entry) { - $result = $this->dispatcher->dispatch( - __CLASS__, - $name, - [$configuration, $entry] - ); + // @todo migrate to events + #$result = $this->dispatcher->dispatch( + # __CLASS__, + # $name, + # [$configuration, $entry] + #); return $result[1]; } diff --git a/Classes/Service/DatabaseService.php b/Classes/Service/DatabaseService.php index e290f7b..b1ea15d 100644 --- a/Classes/Service/DatabaseService.php +++ b/Classes/Service/DatabaseService.php @@ -20,10 +20,6 @@ class DatabaseService */ public function getDatabaseConnection() { - if (VersionNumberUtility::convertVersionNumberToInteger(VersionNumberUtility::getNumericTypo3Version()) > 9005000) { - return GeneralUtility::makeInstance(DatabaseConnection::class); - } - - return $GLOBALS['TYPO3_DB']; + return GeneralUtility::makeInstance(DatabaseConnection::class); } } diff --git a/Classes/Service/ImportService.php b/Classes/Service/ImportService.php index 5e3371f..2679372 100644 --- a/Classes/Service/ImportService.php +++ b/Classes/Service/ImportService.php @@ -7,7 +7,7 @@ use HDNET\Importr\Domain\Model\Import; use HDNET\Importr\Domain\Model\Strategy; use HDNET\Importr\Domain\Repository\ImportRepository; -use TYPO3\CMS\Extbase\Object\ObjectManagerInterface; +use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Extbase\Persistence\PersistenceManagerInterface; /** @@ -20,10 +20,6 @@ class ImportService implements ImportServiceInterface */ protected $persistenceManager; - /** - * @var ObjectManagerInterface - */ - protected $objectManager; /** * @var ImportRepository @@ -34,13 +30,11 @@ class ImportService implements ImportServiceInterface * ImportService constructor. * * @param PersistenceManagerInterface $persistenceManager - * @param ObjectManagerInterface $objectManager * @param ImportRepository $importRepository */ - public function __construct(PersistenceManagerInterface $persistenceManager, ObjectManagerInterface $objectManager, ImportRepository $importRepository) + public function __construct(PersistenceManagerInterface $persistenceManager, ImportRepository $importRepository) { $this->persistenceManager = $persistenceManager; - $this->objectManager = $objectManager; $this->importRepository = $importRepository; } @@ -64,7 +58,7 @@ public function updateImport(Import $import, $pointer = null) */ public function addToQueue($filepath, Strategy $strategy, array $configuration = []) { - $import = $this->objectManager->get(Import::class); + $import = GeneralUtility::makeInstance(Import::class); $start = 'now'; if (isset($configuration['start'])) { $start = $configuration['start']; diff --git a/Classes/Service/Manager.php b/Classes/Service/Manager.php index 1b147ad..4414ddb 100644 --- a/Classes/Service/Manager.php +++ b/Classes/Service/Manager.php @@ -10,9 +10,9 @@ use HDNET\Importr\Exception\ReinitializeException; use HDNET\Importr\Processor\Configuration; use HDNET\Importr\Processor\Resource; -use TYPO3\CMS\Extbase\Object\ObjectManager; +use Psr\EventDispatcher\EventDispatcherInterface; +use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager; -use TYPO3\CMS\Extbase\SignalSlot\Dispatcher; /** * Service Manager @@ -28,21 +28,12 @@ class Manager implements ManagerInterface */ protected $importRepository; - /** - * @var \TYPO3\CMS\Extbase\SignalSlot\Dispatcher - */ - protected $signalSlotDispatcher; /** * @var \TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager */ protected $persistenceManager; - /** - * @var \TYPO3\CMS\Extbase\Object\ObjectManager - */ - protected $objectManager; - /** * @var \HDNET\Importr\Processor\Configuration */ @@ -55,16 +46,13 @@ class Manager implements ManagerInterface public function __construct( ImportRepository $importRepository, - Dispatcher $signalSlotDispatcher, + protected EventDispatcherInterface $eventDispatcher, PersistenceManager $persistenceManager, - ObjectManager $objectManager, Configuration $configuration, Resource $resource ) { $this->importRepository = $importRepository; - $this->signalSlotDispatcher = $signalSlotDispatcher; $this->persistenceManager = $persistenceManager; - $this->objectManager = $objectManager; $this->configuration = $configuration; $this->resource = $resource; } @@ -167,7 +155,7 @@ protected function initializeResources(Strategy $strategy, $filepath) $resources = []; $resourceConfiguration = $strategy->getResources(); foreach ($resourceConfiguration as $resource => $configuration) { - $object = $this->objectManager->get($resource); + $object = GeneralUtility::makeInstance($resource); $object->start($strategy, $filepath); $object->setConfiguration($configuration); $resources[$resource] = $object; @@ -194,7 +182,7 @@ protected function addTargets(array $targetConfiguration, Import $import, array $targets = $this->addTargets($configuration, $import, $targets); continue; } - $object = $this->objectManager->get($target); + $object = GeneralUtility::makeInstance($target); $object->setConfiguration($configuration); $object->getConfiguration(); $object->start($import->getStrategy()); @@ -220,7 +208,7 @@ protected function endTargets(array $targetConfiguration, Import $import): void $this->endTargets($configuration, $import); continue; } - $object = $this->objectManager->get($target); + $object = GeneralUtility::makeInstance($target); $object->setConfiguration($configuration); $object->getConfiguration(); $object->end($import->getStrategy()); @@ -249,10 +237,12 @@ public function getUpdateInterval() */ protected function emitSignal($name, Import $import) { - $this->signalSlotDispatcher->dispatch( - __CLASS__, - $name, - [$this, $import] - ); + + // @todo migrate to events + #$this->signalSlotDispatcher->dispatch( + # __CLASS__, + # $name, + # [$this, $import] + #); } } diff --git a/Classes/Service/PasswordHashService.php b/Classes/Service/PasswordHashService.php index fcaa47e..2d259cd 100644 --- a/Classes/Service/PasswordHashService.php +++ b/Classes/Service/PasswordHashService.php @@ -21,6 +21,7 @@ class PasswordHashService public function hash($password) { if (ExtensionManagementUtility::isLoaded('saltedpasswords')) { + // @todo migration for v12 $salter = SaltFactory::getSaltingInstance(null, 'FE'); $password = $salter->getHashedPassword($password); diff --git a/Classes/Service/Targets/ExtbaseModel.php b/Classes/Service/Targets/ExtbaseModel.php index a981423..98d7264 100644 --- a/Classes/Service/Targets/ExtbaseModel.php +++ b/Classes/Service/Targets/ExtbaseModel.php @@ -4,8 +4,8 @@ namespace HDNET\Importr\Service\Targets; use HDNET\Importr\Domain\Model\Strategy; +use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Extbase\DomainObject\AbstractEntity; -use TYPO3\CMS\Extbase\Object\ObjectManagerInterface; use TYPO3\CMS\Extbase\Persistence\PersistenceManagerInterface; /** @@ -31,21 +31,15 @@ class ExtbaseModel extends AbstractTarget implements TargetInterface */ protected $persistenceManager; - /** - * @var \TYPO3\CMS\Extbase\Object\ObjectManagerInterface - */ - protected $objectManager; /** * ExtbaseModel constructor. * * @param \TYPO3\CMS\Extbase\Persistence\PersistenceManagerInterface $persistenceManager - * @param \TYPO3\CMS\Extbase\Object\ObjectManagerInterface $objectManager */ - public function __construct(PersistenceManagerInterface $persistenceManager, ObjectManagerInterface $objectManager) + public function __construct(PersistenceManagerInterface $persistenceManager) { $this->persistenceManager = $persistenceManager; - $this->objectManager = $objectManager; } /** @@ -77,7 +71,7 @@ public function start(Strategy $strategy) public function processEntry(array $entry) { $configuration = $this->getConfiguration(); - $this->repository = $this->objectManager->get($configuration['repository']); + $this->repository = GeneralUtility::makeInstance($configuration['repository']); $model = $this->mapModel($this->getModel(), $configuration['mapping'], $entry); $this->repository->add($model); diff --git a/Classes/Utility.php b/Classes/Utility.php deleted file mode 100644 index a392434..0000000 --- a/Classes/Utility.php +++ /dev/null @@ -1,28 +0,0 @@ - [ + 'parent' => 'file', + 'access' => 'user,group', + 'path' => '/module/file/impotr', + 'labels' => 'LLL:EXT:importr/Resources/Private/Language/locallang_mod.xlf', + 'extensionName' => 'Importr', + 'controllerActions' => [ + ImportrController::class => [ + 'index', 'import', 'preview', 'create', 'reset' + ], + ], + ], +]; diff --git a/Configuration/TCA/tx_importr_domain_model_import.php b/Configuration/TCA/tx_importr_domain_model_import.php index 0701893..21e98d4 100644 --- a/Configuration/TCA/tx_importr_domain_model_import.php +++ b/Configuration/TCA/tx_importr_domain_model_import.php @@ -23,29 +23,15 @@ 'starttime' => [ 'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.starttime', 'config' => [ - 'type' => 'input', - 'size' => 13, - 'max' => 20, - 'eval' => 'datetime', - 'checkbox' => 0, - 'default' => 0, - 'range' => [ - 'lower' => mktime(0, 0, 0, date('m'), date('d'), date('Y')) - ], + 'type' => 'datetime', + 'format' => 'datetime', ], ], 'endtime' => [ 'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.endtime', 'config' => [ - 'type' => 'input', - 'size' => 13, - 'max' => 20, - 'eval' => 'datetime', - 'checkbox' => 0, - 'default' => 0, - 'range' => [ - 'lower' => mktime(0, 0, 0, date('m'), date('d'), date('Y')) - ], + 'type' => 'datetime', + 'format' => 'datetime', ], ], 'pointer' => [ @@ -107,29 +93,8 @@ 'filepath' => [ 'label' => 'LLL:EXT:importr/Resources/Private/Language/locallang.xlf:filepath', 'config' => [ - 'type' => 'input', - 'size' => 50, - 'eval' => 'trim,required', - 'wizards' => [ - '_PADDING' => 2, - 'link' => [ - 'type' => 'popup', - 'title' => 'Link', - 'icon' => 'link_popup.gif', - 'module' => [ - 'name' => 'wizard_element_browser', - 'urlParameters' => [ - 'mode' => 'wizard', - 'act' => 'file' - ] - ], - 'JSopenParams' => 'height=300,width=500,status=0,menubar=0,scrollbars=1', - 'params' => [ - 'blindLinkOptions' => 'page,url,mail,spec,folder', - 'allowedExtensions' => $GLOBALS['TYPO3_CONF_VARS']['SYS']['textfile_ext'], - ] - ], - ], + 'type' => 'link', + 'allowedTypes' => ['file'], ], ], 'strategy' => [ diff --git a/Configuration/TCA/tx_importr_domain_model_strategy.php b/Configuration/TCA/tx_importr_domain_model_strategy.php index fd283d5..609e955 100644 --- a/Configuration/TCA/tx_importr_domain_model_strategy.php +++ b/Configuration/TCA/tx_importr_domain_model_strategy.php @@ -37,25 +37,8 @@ 'configuration_file' => [ 'label' => 'LLL:EXT:importr/Resources/Private/Language/locallang.xlf:configuration_file', 'config' => [ - 'type' => 'input', - 'eval' => 'trim', - 'max' => 256, - 'size' => 60, - 'softref' => 'typolink', - 'wizards' => [ - 'link' => [ - 'icon' => 'EXT:backend/Resources/Public/Images/FormFieldWizard/wizard_link.gif', - 'title' => 'File', - 'type' => 'popup', - 'module' => [ - 'name' => 'wizard_link', - 'urlParameters' => [ - 'mode' => 'wizard', - ], - ], - ], - '_PADDING' => 2, - ], + 'type' => 'link', + 'allowedTypes' => ['file'], ], ], 'resources' => [ @@ -69,25 +52,8 @@ 'resources_file' => [ 'label' => 'LLL:EXT:importr/Resources/Private/Language/locallang.xlf:resources_file', 'config' => [ - 'type' => 'input', - 'eval' => 'trim', - 'max' => 256, - 'size' => 60, - 'softref' => 'typolink', - 'wizards' => [ - 'link' => [ - 'icon' => 'EXT:backend/Resources/Public/Images/FormFieldWizard/wizard_link.gif', - 'title' => 'File', - 'type' => 'popup', - 'module' => [ - 'name' => 'wizard_link', - 'urlParameters' => [ - 'mode' => 'wizard', - ], - ], - ], - '_PADDING' => 2, - ], + 'type' => 'link', + 'allowedTypes' => ['file'], ], ], 'targets' => [ @@ -101,25 +67,8 @@ 'targets_file' => [ 'label' => 'LLL:EXT:importr/Resources/Private/Language/locallang.xlf:targets_file', 'config' => [ - 'type' => 'input', - 'eval' => 'trim', - 'max' => 256, - 'size' => 60, - 'softref' => 'typolink', - 'wizards' => [ - 'link' => [ - 'icon' => 'EXT:backend/Resources/Public/Images/FormFieldWizard/wizard_link.gif', - 'title' => 'File', - 'type' => 'popup', - 'module' => [ - 'name' => 'wizard_link', - 'urlParameters' => [ - 'mode' => 'wizard', - ], - ], - ], - '_PADDING' => 2, - ], + 'type' => 'link', + 'allowedTypes' => ['file'], ], ], 'general' => [ diff --git a/ext_icon.svg b/Resources/Public/Icons/Extension.svg similarity index 100% rename from ext_icon.svg rename to Resources/Public/Icons/Extension.svg diff --git a/Tests/Unit/ManagerTest.php b/Tests/Unit/ManagerTest.php index 8d00993..7a2c724 100644 --- a/Tests/Unit/ManagerTest.php +++ b/Tests/Unit/ManagerTest.php @@ -12,8 +12,6 @@ use HDNET\Importr\Service\ManagerInterface; use HDNET\Importr\Service\Resources\ResourceInterface; use ReflectionClass; -use TYPO3\CMS\Extbase\Object\ObjectManager; -use TYPO3\CMS\Extbase\Object\ObjectManagerInterface; use TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager; use TYPO3\CMS\Extbase\SignalSlot\Dispatcher; use TYPO3\TestingFramework\Core\Unit\UnitTestCase; @@ -62,11 +60,6 @@ public function is_preview_generated_correct() $resource->expects(self::any())->method('getEntry')->willReturn('test'); $resource->expects(self::once())->method('getFilepathExpression')->willReturn('/\.csv$/'); - $objectManager = $this->getMockBuilder(ObjectManagerInterface::class)->getMock(); - $objectManager->expects(self::once())->method('get')->willReturnCallback(function () use ($resource) { - return $resource; - }); - $this->setProtectedProperty($manager, 'objectManager', $objectManager); $strategy = $this->getAccessibleMock(Strategy::class); $filepath = './import.csv'; @@ -86,7 +79,6 @@ protected function createManagerWithMockInputs(): ManagerInterface $this->createMock(ImportRepository::class), $this->createMock(Dispatcher::class), $this->createMock(PersistenceManager::class), - $this->createMock(ObjectManager::class), $this->createMock(Configuration::class), $this->createMock(Resource::class) ); diff --git a/Tests/Unit/Service/ImportServiceTest.php b/Tests/Unit/Service/ImportServiceTest.php index e6f5d54..2983f73 100644 --- a/Tests/Unit/Service/ImportServiceTest.php +++ b/Tests/Unit/Service/ImportServiceTest.php @@ -7,7 +7,6 @@ use HDNET\Importr\Domain\Model\Strategy; use HDNET\Importr\Domain\Repository\ImportRepository; use HDNET\Importr\Service\ImportService; -use TYPO3\CMS\Extbase\Object\ObjectManagerInterface; use TYPO3\CMS\Extbase\Persistence\PersistenceManagerInterface; use TYPO3\TestingFramework\Core\Unit\UnitTestCase; @@ -24,20 +23,14 @@ class ImportServiceTest extends UnitTestCase */ protected $repository; - /** - * @var ObjectManagerInterface - */ - protected $objectManager; public function setUp(): void { $persistenceManager = $this->getMockBuilder(PersistenceManagerInterface::class)->getMock(); - $objectManager = $this->getMockBuilder(ObjectManagerInterface::class)->getMock(); $repository = $this->getMockBuilder(ImportRepository::class)->disableOriginalConstructor()->getMock(); $this->repository = $repository; - $this->objectManager = $objectManager; - $this->fixture = new ImportService($persistenceManager, $objectManager, $repository); + $this->fixture = new ImportService($persistenceManager, $repository); } /** @@ -70,9 +63,6 @@ public function is_import_added_to_queue() return $date->format(\DateTime::ATOM) === $time; })); - $this->objectManager->expects(self::once())->method('get')->with(Import::class)->willReturnCallback(function () use ($import) { - return $import; - }); $this->repository->expects(self::once())->method('add')->with(self::isInstanceOf(Import::class)); @@ -90,10 +80,6 @@ public function is_datetime_created_with_invalid_text() $import->expects(self::once())->method('setStarttime')->with(self::isInstanceOf(\DateTime::class)); - $this->objectManager->expects(self::once())->method('get')->with(Import::class)->willReturnCallback(function () use ($import) { - return $import; - }); - $this->fixture->addToQueue($path, $strategy, ['start' => 'Lorem ipsum']); } } diff --git a/composer.json b/composer.json index 4d23ce1..2ce8a44 100644 --- a/composer.json +++ b/composer.json @@ -25,8 +25,8 @@ } ], "require": { - "php": "^7.2||^8.0", - "typo3/cms-core": "^10.4||^11.5" + "php": "^8.1", + "typo3/cms-core": "^12.4" }, "suggest": { "phpoffice/phpexcel": "Use Excel files as import resource" @@ -77,4 +77,4 @@ "phpunit -c Tests/UnitTests.xml" ] } -} \ No newline at end of file +} diff --git a/dynamicReturnTypeMeta.json b/dynamicReturnTypeMeta.json deleted file mode 100644 index 41c84db..0000000 --- a/dynamicReturnTypeMeta.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - // configuration file for PHPStorm Plugin: http://plugins.jetbrains.com/plugin/7251 - "methodCalls": [ - // Do not add the methods getMock or getAccessibleMock to this configuration - // because additive type information gets lost. Use comments to define object types. - { - "class": "\\TYPO3\\CMS\\Core\\Utility\\GeneralUtility", - "method": "makeInstance", - "position": 0 - }, - { - "class": "\\TYPO3\\CMS\\Extbase\\Object\\ObjectManagerInterface", - "method": "get", - "position": 0 - } - ], - "functionCalls": [ - ] -} diff --git a/ext_emconf.php b/ext_emconf.php index c24e7df..6a8131d 100644 --- a/ext_emconf.php +++ b/ext_emconf.php @@ -14,15 +14,15 @@ 'title' => 'Importr', 'description' => 'Flexible importer for all kinds of files!', 'category' => 'be', - 'version' => '5.0.0', + 'version' => '6.0.0-dev', 'state' => 'stable', 'author' => 'Tim Lochmüller, Tim Spiekerkötter', 'author_email' => 'tl@hdnet.de, ts@hdnet.de', 'author_company' => '', 'constraints' => [ 'depends' => [ - 'typo3' => '10.4.0-11.5.99', - 'php' => '7.2.0-8.1.99' + 'typo3' => '12.4.0-12.4.99', + 'php' => '8.1.0-8.2.99' ], ], 'autoload' => [ diff --git a/ext_icon.gif b/ext_icon.gif deleted file mode 100644 index 3ea2e2e..0000000 Binary files a/ext_icon.gif and /dev/null differ diff --git a/ext_icon.png b/ext_icon.png deleted file mode 100644 index 1757b09..0000000 Binary files a/ext_icon.png and /dev/null differ diff --git a/ext_tables.php b/ext_tables.php deleted file mode 100644 index 8a4683d..0000000 --- a/ext_tables.php +++ /dev/null @@ -1,15 +0,0 @@ - 'index,import,preview,create,reset', -], [ - 'access' => 'user,group', - 'icon' => 'EXT:importr/ext_icon.svg', - 'labels' => 'LLL:EXT:importr/Resources/Private/Language/locallang_mod.xlf', -]);