mirror of
https://github.com/werkraum-media/thuecat.git
synced 2024-07-05 17:58:34 +02:00
Daniel Siepmann
2e4c9cc04e
* Support generation of code coverage generation * Remove useless caching within GitHub * Add TYPO3 11.5 within CI * Update phpstan Replace friendsoftypo3/phpstan-typo3 with saschaegerer/phpstan. The friendsoftypo3 is intended for TYPO3 itself, while saschaegerer is intended for community. Also update all related packages. Fix some new findings and update baseline. * Run composer none interactive in CI * Remove dependency checker * Migrate tests to no longer use legacy dependencies * https://forge.typo3.org/issues/97479 * Fix phpstan findings
111 lines
4.2 KiB
PHP
111 lines
4.2 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
/*
|
|
* Copyright (C) 2021 Daniel Siepmann <coding@daniel-siepmann.de>
|
|
*
|
|
* This program is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU General Public License
|
|
* as published by the Free Software Foundation; either version 2
|
|
* of the License, or (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program; if not, write to the Free Software
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
|
* 02110-1301, USA.
|
|
*/
|
|
|
|
namespace WerkraumMedia\ThueCat\Tests\Unit\Domain\Import\Typo3Converter;
|
|
|
|
use Psr\Log\LoggerInterface;
|
|
use WerkraumMedia\ThueCat\Domain\Import\Entity\Properties\ForeignReference;
|
|
use WerkraumMedia\ThueCat\Domain\Import\Entity\Town;
|
|
use WerkraumMedia\ThueCat\Domain\Import\Importer;
|
|
use WerkraumMedia\ThueCat\Domain\Import\Typo3Converter\GeneralConverter;
|
|
use PHPUnit\Framework\TestCase;
|
|
use WerkraumMedia\ThueCat\Domain\Import\ResolveForeignReference;
|
|
use WerkraumMedia\ThueCat\Domain\Import\Typo3Converter\LanguageHandling;
|
|
use WerkraumMedia\ThueCat\Domain\Model\Backend\ImportConfiguration;
|
|
use WerkraumMedia\ThueCat\Domain\Model\Backend\ImportLog;
|
|
use WerkraumMedia\ThueCat\Domain\Repository\Backend\OrganisationRepository;
|
|
use WerkraumMedia\ThueCat\Domain\Repository\Backend\ParkingFacilityRepository;
|
|
use WerkraumMedia\ThueCat\Domain\Repository\Backend\TownRepository;
|
|
|
|
/**
|
|
* @covers \WerkraumMedia\ThueCat\Domain\Import\Typo3Converter\GeneralConverter
|
|
*/
|
|
class GeneralConverterTest extends TestCase
|
|
{
|
|
/**
|
|
* @test
|
|
*/
|
|
public function canBeCreated(): void
|
|
{
|
|
$resolveForeignReference = $this->createStub(ResolveForeignReference::class);
|
|
$importer = $this->createStub(Importer::class);
|
|
$languageHandling = $this->createStub(LanguageHandling::class);
|
|
$organisationRepository = $this->createStub(OrganisationRepository::class);
|
|
$townRepository = $this->createStub(TownRepository::class);
|
|
$parkingFacilityRepository = $this->createStub(ParkingFacilityRepository::class);
|
|
|
|
$subject = new GeneralConverter(
|
|
$resolveForeignReference,
|
|
$importer,
|
|
$languageHandling,
|
|
$organisationRepository,
|
|
$townRepository,
|
|
$parkingFacilityRepository
|
|
);
|
|
|
|
self::assertInstanceOf(
|
|
GeneralConverter::class,
|
|
$subject
|
|
);
|
|
}
|
|
|
|
/**
|
|
* @test
|
|
*/
|
|
public function skipsWithoutManager(): void
|
|
{
|
|
$resolveForeignReference = $this->createStub(ResolveForeignReference::class);
|
|
$importer = $this->createStub(Importer::class);
|
|
$importer->method('importConfiguration')->willReturn(new ImportLog());
|
|
$languageHandling = $this->createStub(LanguageHandling::class);
|
|
$languageHandling->method('getLanguageUidForString')->willReturn(0);
|
|
$organisationRepository = $this->createStub(OrganisationRepository::class);
|
|
$townRepository = $this->createStub(TownRepository::class);
|
|
$parkingFacilityRepository = $this->createStub(ParkingFacilityRepository::class);
|
|
$logger = $this->createStub(LoggerInterface::class);
|
|
|
|
$subject = new GeneralConverter(
|
|
$resolveForeignReference,
|
|
$importer,
|
|
$languageHandling,
|
|
$organisationRepository,
|
|
$townRepository,
|
|
$parkingFacilityRepository
|
|
);
|
|
$subject->setLogger($logger);
|
|
|
|
$contentResponsible = new ForeignReference();
|
|
$contentResponsible->setId('https://example.com/content-responsible');
|
|
$entity = new Town();
|
|
$entity->setName('Test Name');
|
|
$entity->setContentResponsible($contentResponsible);
|
|
|
|
$configuration = new ImportConfiguration();
|
|
$configuration->_setProperty('storagePid', 10);
|
|
|
|
self::assertNull(
|
|
$subject->convert($entity, $configuration, 'de')
|
|
);
|
|
}
|
|
}
|