Fix @covers and @uses annotations within tests

Always use `\` prefix as best practice.
Add missing new classes.
This commit is contained in:
Daniel Siepmann 2021-06-01 11:11:50 +02:00
parent e13bb35252
commit 9cfb0fdb3a
27 changed files with 210 additions and 71 deletions

View file

@ -33,42 +33,44 @@ use TYPO3\CMS\Extbase\Core\Bootstrap;
use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase as TestCase;
/**
* @covers WerkraumMedia\ThueCat\Controller\Backend\AbstractController
* @covers WerkraumMedia\ThueCat\Controller\Backend\ImportController
* @covers WerkraumMedia\ThueCat\DependencyInjection\ConverterPass
* @covers WerkraumMedia\ThueCat\DependencyInjection\UrlProvidersPass
* @covers WerkraumMedia\ThueCat\Domain\Import\Importer\SaveData
* @covers WerkraumMedia\ThueCat\Domain\Repository\Backend\ImportLogRepository
* @covers WerkraumMedia\ThueCat\Domain\Repository\Backend\OrganisationRepository
* @covers WerkraumMedia\ThueCat\Domain\Repository\Backend\TownRepository
* @covers WerkraumMedia\ThueCat\Extension
* @covers WerkraumMedia\ThueCat\Typo3Wrapper\TranslationService
* @covers WerkraumMedia\ThueCat\View\Backend\Menu
* @covers \WerkraumMedia\ThueCat\Controller\Backend\AbstractController
* @covers \WerkraumMedia\ThueCat\Controller\Backend\ImportController
* @covers \WerkraumMedia\ThueCat\DependencyInjection\ConverterPass
* @covers \WerkraumMedia\ThueCat\DependencyInjection\UrlProvidersPass
* @covers \WerkraumMedia\ThueCat\Domain\Import\Importer\SaveData
* @covers \WerkraumMedia\ThueCat\Domain\Repository\Backend\ImportLogRepository
* @covers \WerkraumMedia\ThueCat\Domain\Repository\Backend\OrganisationRepository
* @covers \WerkraumMedia\ThueCat\Domain\Repository\Backend\TownRepository
* @covers \WerkraumMedia\ThueCat\Extension
* @covers \WerkraumMedia\ThueCat\Typo3Wrapper\TranslationService
* @covers \WerkraumMedia\ThueCat\View\Backend\Menu
*
* @uses WerkraumMedia\ThueCat\Domain\Import\Converter\Organisation
* @uses WerkraumMedia\ThueCat\Domain\Import\Converter\Registry
* @uses WerkraumMedia\ThueCat\Domain\Import\Converter\TouristAttraction
* @uses WerkraumMedia\ThueCat\Domain\Import\Converter\TouristInformation
* @uses WerkraumMedia\ThueCat\Domain\Import\Converter\Town
* @uses WerkraumMedia\ThueCat\Domain\Import\Importer
* @uses WerkraumMedia\ThueCat\Domain\Import\Importer\FetchData
* @uses WerkraumMedia\ThueCat\Domain\Import\Importer\LanguageHandling
* @uses WerkraumMedia\ThueCat\Domain\Import\JsonLD\Parser
* @uses WerkraumMedia\ThueCat\Domain\Import\JsonLD\Parser\Address
* @uses WerkraumMedia\ThueCat\Domain\Import\JsonLD\Parser\GenericFields
* @uses WerkraumMedia\ThueCat\Domain\Import\JsonLD\Parser\LanguageValues
* @uses WerkraumMedia\ThueCat\Domain\Import\JsonLD\Parser\Media
* @uses WerkraumMedia\ThueCat\Domain\Import\JsonLD\Parser\Offers
* @uses WerkraumMedia\ThueCat\Domain\Import\JsonLD\Parser\OpeningHours
* @uses WerkraumMedia\ThueCat\Domain\Import\JsonLD\Parser\OpeningHours
* @uses WerkraumMedia\ThueCat\Domain\Import\Model\EntityCollection
* @uses WerkraumMedia\ThueCat\Domain\Import\Model\GenericEntity
* @uses WerkraumMedia\ThueCat\Domain\Import\RequestFactory
* @uses WerkraumMedia\ThueCat\Domain\Import\UrlProvider\Registry
* @uses WerkraumMedia\ThueCat\Domain\Import\UrlProvider\StaticUrlProvider
* @uses WerkraumMedia\ThueCat\Domain\Model\Backend\ImportConfiguration
* @uses WerkraumMedia\ThueCat\Domain\Model\Backend\ImportLog
* @uses WerkraumMedia\ThueCat\Domain\Model\Backend\ImportLogEntry
* @uses \WerkraumMedia\ThueCat\Domain\Import\Converter\Organisation
* @uses \WerkraumMedia\ThueCat\Domain\Import\Converter\Registry
* @uses \WerkraumMedia\ThueCat\Domain\Import\Converter\TouristAttraction
* @uses \WerkraumMedia\ThueCat\Domain\Import\Converter\TouristInformation
* @uses \WerkraumMedia\ThueCat\Domain\Import\Converter\Town
* @uses \WerkraumMedia\ThueCat\Domain\Import\Importer
* @uses \WerkraumMedia\ThueCat\Domain\Import\Importer\FetchData
* @uses \WerkraumMedia\ThueCat\Domain\Import\Importer\LanguageHandling
* @uses \WerkraumMedia\ThueCat\Domain\Import\JsonLD\Parser
* @uses \WerkraumMedia\ThueCat\Domain\Import\JsonLD\Parser\Address
* @uses \WerkraumMedia\ThueCat\Domain\Import\JsonLD\Parser\GenericFields
* @uses \WerkraumMedia\ThueCat\Domain\Import\JsonLD\Parser\LanguageValues
* @uses \WerkraumMedia\ThueCat\Domain\Import\JsonLD\Parser\Media
* @uses \WerkraumMedia\ThueCat\Domain\Import\JsonLD\Parser\Offers
* @uses \WerkraumMedia\ThueCat\Domain\Import\JsonLD\Parser\OpeningHours
* @uses \WerkraumMedia\ThueCat\Domain\Import\JsonLD\Parser\OpeningHours
* @uses \WerkraumMedia\ThueCat\Domain\Import\Model\EntityCollection
* @uses \WerkraumMedia\ThueCat\Domain\Import\Model\GenericEntity
* @uses \WerkraumMedia\ThueCat\Domain\Import\RequestFactory
* @uses \WerkraumMedia\ThueCat\Domain\Import\UrlProvider\Registry
* @uses \WerkraumMedia\ThueCat\Domain\Import\UrlProvider\StaticUrlProvider
* @uses \WerkraumMedia\ThueCat\Domain\Import\UrlProvider\SyncScopeUrlProvider
* @uses \WerkraumMedia\ThueCat\Domain\Model\Backend\ImportConfiguration
* @uses \WerkraumMedia\ThueCat\Domain\Model\Backend\ImportLog
* @uses \WerkraumMedia\ThueCat\Domain\Model\Backend\ImportLogEntry
* @uses \WerkraumMedia\ThueCat\Domain\Model\Backend\ImportLogEntry
*
* @testdox The import
*/

View file

@ -34,9 +34,10 @@ use WerkraumMedia\ThueCat\Domain\Import\Model\EntityCollection;
use WerkraumMedia\ThueCat\Domain\Model\Backend\ImportConfiguration;
/**
* @covers WerkraumMedia\ThueCat\Domain\Import\Converter\Organisation
* @uses WerkraumMedia\ThueCat\Domain\Import\Model\EntityCollection
* @uses WerkraumMedia\ThueCat\Domain\Import\Model\GenericEntity
* @covers \WerkraumMedia\ThueCat\Domain\Import\Converter\Organisation
*
* @uses \WerkraumMedia\ThueCat\Domain\Import\Model\EntityCollection
* @uses \WerkraumMedia\ThueCat\Domain\Import\Model\GenericEntity
*/
class OrganisationTest extends TestCase
{

View file

@ -29,7 +29,7 @@ use WerkraumMedia\ThueCat\Domain\Import\Converter\Converter;
use WerkraumMedia\ThueCat\Domain\Import\Converter\Registry;
/**
* @covers WerkraumMedia\ThueCat\Domain\Import\Converter\Registry
* @covers \WerkraumMedia\ThueCat\Domain\Import\Converter\Registry
*/
class RegistryTest extends TestCase
{

View file

@ -38,9 +38,10 @@ use WerkraumMedia\ThueCat\Domain\Repository\Backend\OrganisationRepository;
use WerkraumMedia\ThueCat\Domain\Repository\Backend\TownRepository;
/**
* @covers WerkraumMedia\ThueCat\Domain\Import\Converter\TouristAttraction
* @uses WerkraumMedia\ThueCat\Domain\Import\Model\EntityCollection
* @uses WerkraumMedia\ThueCat\Domain\Import\Model\GenericEntity
* @covers \WerkraumMedia\ThueCat\Domain\Import\Converter\TouristAttraction
*
* @uses \WerkraumMedia\ThueCat\Domain\Import\Model\EntityCollection
* @uses \WerkraumMedia\ThueCat\Domain\Import\Model\GenericEntity
*/
class TouristAttractionTest extends TestCase
{

View file

@ -38,9 +38,10 @@ use WerkraumMedia\ThueCat\Domain\Repository\Backend\OrganisationRepository;
use WerkraumMedia\ThueCat\Domain\Repository\Backend\TownRepository;
/**
* @covers WerkraumMedia\ThueCat\Domain\Import\Converter\TouristInformation
* @uses WerkraumMedia\ThueCat\Domain\Import\Model\EntityCollection
* @uses WerkraumMedia\ThueCat\Domain\Import\Model\GenericEntity
* @covers \WerkraumMedia\ThueCat\Domain\Import\Converter\TouristInformation
*
* @uses \WerkraumMedia\ThueCat\Domain\Import\Model\EntityCollection
* @uses \WerkraumMedia\ThueCat\Domain\Import\Model\GenericEntity
*/
class TouristInformationTest extends TestCase
{

View file

@ -36,9 +36,10 @@ use WerkraumMedia\ThueCat\Domain\Model\Backend\Organisation;
use WerkraumMedia\ThueCat\Domain\Repository\Backend\OrganisationRepository;
/**
* @covers WerkraumMedia\ThueCat\Domain\Import\Converter\Town
* @uses WerkraumMedia\ThueCat\Domain\Import\Model\EntityCollection
* @uses WerkraumMedia\ThueCat\Domain\Import\Model\GenericEntity
* @covers \WerkraumMedia\ThueCat\Domain\Import\Converter\Town
*
* @uses \WerkraumMedia\ThueCat\Domain\Import\Model\EntityCollection
* @uses \WerkraumMedia\ThueCat\Domain\Import\Model\GenericEntity
*/
class TownTest extends TestCase
{

View file

@ -34,7 +34,7 @@ use WerkraumMedia\ThueCat\Domain\Import\Importer\FetchData;
use WerkraumMedia\ThueCat\Domain\Import\Importer\FetchData\InvalidResponseException;
/**
* @covers WerkraumMedia\ThueCat\Domain\Import\Importer\FetchData
* @covers \WerkraumMedia\ThueCat\Domain\Import\Importer\FetchData
*/
class FetchDataTest extends TestCase
{

View file

@ -29,7 +29,7 @@ use TYPO3\CMS\Core\Site\SiteFinder;
use WerkraumMedia\ThueCat\Domain\Import\Importer\LanguageHandling;
/**
* @covers WerkraumMedia\ThueCat\Domain\Import\Importer\LanguageHandling
* @covers \WerkraumMedia\ThueCat\Domain\Import\Importer\LanguageHandling
*/
class LanguageHandlingTest extends TestCase
{

View file

@ -39,8 +39,8 @@ use WerkraumMedia\ThueCat\Domain\Model\Backend\ImportLog;
use WerkraumMedia\ThueCat\Domain\Repository\Backend\ImportLogRepository;
/**
* @covers WerkraumMedia\ThueCat\Domain\Import\Importer
* @uses WerkraumMedia\ThueCat\Domain\Model\Backend\ImportLog
* @covers \WerkraumMedia\ThueCat\Domain\Import\Importer
* @uses \WerkraumMedia\ThueCat\Domain\Model\Backend\ImportLog
*/
class ImporterTest extends TestCase
{

View file

@ -25,7 +25,7 @@ use PHPUnit\Framework\TestCase;
use WerkraumMedia\ThueCat\Domain\Import\JsonLD\Parser\Address;
/**
* @covers WerkraumMedia\ThueCat\Domain\Import\JsonLD\Parser\Address
* @covers \WerkraumMedia\ThueCat\Domain\Import\JsonLD\Parser\Address
*/
class AddressTest extends TestCase
{

View file

@ -28,7 +28,7 @@ use WerkraumMedia\ThueCat\Domain\Import\JsonLD\Parser\GenericFields;
use WerkraumMedia\ThueCat\Domain\Import\JsonLD\Parser\LanguageValues;
/**
* @covers WerkraumMedia\ThueCat\Domain\Import\JsonLD\Parser\GenericFields
* @covers \WerkraumMedia\ThueCat\Domain\Import\JsonLD\Parser\GenericFields
*/
class GenericFieldsTest extends TestCase
{

View file

@ -27,7 +27,7 @@ use TYPO3\CMS\Core\Site\Entity\SiteLanguage;
use WerkraumMedia\ThueCat\Domain\Import\JsonLD\Parser\LanguageValues;
/**
* @covers WerkraumMedia\ThueCat\Domain\Import\JsonLD\Parser\LanguageValues
* @covers \WerkraumMedia\ThueCat\Domain\Import\JsonLD\Parser\LanguageValues
*/
class LanguageValuesTest extends TestCase
{

View file

@ -27,7 +27,7 @@ use WerkraumMedia\ThueCat\Domain\Import\Importer\FetchData;
use WerkraumMedia\ThueCat\Domain\Import\JsonLD\Parser\Media;
/**
* @covers WerkraumMedia\ThueCat\Domain\Import\JsonLD\Parser\Media
* @covers \WerkraumMedia\ThueCat\Domain\Import\JsonLD\Parser\Media
*/
class MediaTest extends TestCase
{

View file

@ -28,7 +28,7 @@ use WerkraumMedia\ThueCat\Domain\Import\JsonLD\Parser\GenericFields;
use WerkraumMedia\ThueCat\Domain\Import\JsonLD\Parser\Offers;
/**
* @covers WerkraumMedia\ThueCat\Domain\Import\JsonLD\Parser\Offers
* @covers \WerkraumMedia\ThueCat\Domain\Import\JsonLD\Parser\Offers
*/
class OffersTest extends TestCase
{

View file

@ -27,7 +27,7 @@ use PHPUnit\Framework\TestCase;
use WerkraumMedia\ThueCat\Domain\Import\JsonLD\Parser\OpeningHours;
/**
* @covers WerkraumMedia\ThueCat\Domain\Import\JsonLD\Parser\OpeningHours
* @covers \WerkraumMedia\ThueCat\Domain\Import\JsonLD\Parser\OpeningHours
*/
class OpeningHoursTest extends TestCase
{

View file

@ -33,7 +33,7 @@ use WerkraumMedia\ThueCat\Domain\Import\JsonLD\Parser\Media;
use WerkraumMedia\ThueCat\Domain\Import\JsonLD\Parser\OpeningHours;
/**
* @covers WerkraumMedia\ThueCat\Domain\Import\JsonLD\Parser
* @covers \WerkraumMedia\ThueCat\Domain\Import\JsonLD\Parser
*/
class ParserTest extends TestCase
{

View file

@ -29,7 +29,7 @@ use WerkraumMedia\ThueCat\Domain\Import\Model\Entity;
use WerkraumMedia\ThueCat\Domain\Import\Model\EntityCollection;
/**
* @covers WerkraumMedia\ThueCat\Domain\Import\Model\EntityCollection
* @covers \WerkraumMedia\ThueCat\Domain\Import\Model\EntityCollection
*/
class EntityCollectionTest extends TestCase
{

View file

@ -27,7 +27,7 @@ use PHPUnit\Framework\TestCase;
use WerkraumMedia\ThueCat\Domain\Import\Model\GenericEntity;
/**
* @covers WerkraumMedia\ThueCat\Domain\Import\Model\GenericEntity
* @covers \WerkraumMedia\ThueCat\Domain\Import\Model\GenericEntity
*/
class GenericEntityTest extends TestCase
{

View file

@ -30,7 +30,7 @@ use TYPO3\CMS\Core\Configuration\ExtensionConfiguration;
use WerkraumMedia\ThueCat\Domain\Import\RequestFactory;
/**
* @covers WerkraumMedia\ThueCat\Domain\Import\RequestFactory
* @covers \WerkraumMedia\ThueCat\Domain\Import\RequestFactory
*/
class RequestFactoryTest extends TestCase
{

View file

@ -30,7 +30,7 @@ use WerkraumMedia\ThueCat\Domain\Import\UrlProvider\UrlProvider;
use WerkraumMedia\ThueCat\Domain\Model\Backend\ImportConfiguration;
/**
* @covers WerkraumMedia\ThueCat\Domain\Import\UrlProvider\Registry
* @covers \WerkraumMedia\ThueCat\Domain\Import\UrlProvider\Registry
*/
class RegistryTest extends TestCase
{

View file

@ -29,7 +29,7 @@ use WerkraumMedia\ThueCat\Domain\Import\UrlProvider\StaticUrlProvider;
use WerkraumMedia\ThueCat\Domain\Model\Backend\ImportConfiguration;
/**
* @covers WerkraumMedia\ThueCat\Domain\Import\UrlProvider\StaticUrlProvider
* @covers \WerkraumMedia\ThueCat\Domain\Import\UrlProvider\StaticUrlProvider
*/
class StaticUrlProviderTest extends TestCase
{
@ -50,7 +50,6 @@ class StaticUrlProviderTest extends TestCase
public function canProvideForStaticConfiguration(): void
{
$configuration = $this->prophesize(ImportConfiguration::class);
$configuration->getUrls()->willReturn([]);
$configuration->getType()->willReturn('static');
$subject = new StaticUrlProvider();
@ -70,7 +69,7 @@ class StaticUrlProviderTest extends TestCase
$subject = new StaticUrlProvider();
$result = $subject->createWithConfiguration($configuration->reveal());
self::assertInstanceOf(StaticUrlProvider::class, $subject);
self::assertInstanceOf(StaticUrlProvider::class, $result);
}
/**

View file

@ -0,0 +1,127 @@
<?php
namespace WerkraumMedia\ThueCat\Tests\Unit\Domain\Import\UrlProvider;
/*
* 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.
*/
use Prophecy\PhpUnit\ProphecyTrait;
use WerkraumMedia\ThueCat\Domain\Import\Importer\FetchData;
use WerkraumMedia\ThueCat\Domain\Import\UrlProvider\SyncScopeUrlProvider;
use PHPUnit\Framework\TestCase;
use WerkraumMedia\ThueCat\Domain\Model\Backend\ImportConfiguration;
/**
* @covers \WerkraumMedia\ThueCat\Domain\Import\UrlProvider\SyncScopeUrlProvider
*/
class SyncScopeUrlProviderTest extends TestCase
{
use ProphecyTrait;
/**
* @test
*/
public function canBeCreated(): void
{
$fetchData = $this->prophesize(FetchData::class);
$subject = new SyncScopeUrlProvider(
$fetchData->reveal()
);
self::assertInstanceOf(SyncScopeUrlProvider::class, $subject);
}
/**
* @test
*/
public function canProvideForSyncScope(): void
{
$configuration = $this->prophesize(ImportConfiguration::class);
$configuration->getType()->willReturn('syncScope');
$fetchData = $this->prophesize(FetchData::class);
$subject = new SyncScopeUrlProvider(
$fetchData->reveal()
);
$result = $subject->canProvideForConfiguration($configuration->reveal());
self::assertTrue($result);
}
/**
* @test
*/
public function returnsConcreteProviderForConfiguration(): void
{
$configuration = $this->prophesize(ImportConfiguration::class);
$configuration->getSyncScopeId()->willReturn(10);
$fetchData = $this->prophesize(FetchData::class);
$fetchData->updatedNodes(10)->willReturn([
'data' => [
'canBeCreated' => [
'835224016581-dara',
'165868194223-zmqf',
],
],
]);
$subject = new SyncScopeUrlProvider(
$fetchData->reveal()
);
$result = $subject->createWithConfiguration($configuration->reveal());
self::assertInstanceOf(SyncScopeUrlProvider::class, $result);
}
/**
* @test
*/
public function concreteProviderReturnsUrls(): void
{
$configuration = $this->prophesize(ImportConfiguration::class);
$configuration->getSyncScopeId()->willReturn(10);
$fetchData = $this->prophesize(FetchData::class);
$fetchData->getResourceEndpoint()->willReturn('https://example.com/api/');
$fetchData->updatedNodes(10)->willReturn([
'data' => [
'createdOrUpdated' => [
'835224016581-dara',
'165868194223-zmqf',
],
],
]);
$subject = new SyncScopeUrlProvider(
$fetchData->reveal()
);
$concreteProvider = $subject->createWithConfiguration($configuration->reveal());
$result = $concreteProvider->getUrls();
self::assertSame([
'https://example.com/api/835224016581-dara',
'https://example.com/api/165868194223-zmqf',
], $result);
}
}

View file

@ -25,7 +25,7 @@ use PHPUnit\Framework\TestCase;
use WerkraumMedia\ThueCat\Domain\Model\Frontend\Address;
/**
* @covers WerkraumMedia\ThueCat\Domain\Model\Frontend\Address
* @covers \WerkraumMedia\ThueCat\Domain\Model\Frontend\Address
*/
class AddressTest extends TestCase
{

View file

@ -25,7 +25,7 @@ use PHPUnit\Framework\TestCase;
use WerkraumMedia\ThueCat\Domain\Model\Frontend\Media;
/**
* @covers WerkraumMedia\ThueCat\Domain\Model\Frontend\Media
* @covers \WerkraumMedia\ThueCat\Domain\Model\Frontend\Media
*/
class MediaTest extends TestCase
{

View file

@ -27,7 +27,11 @@ use PHPUnit\Framework\TestCase;
use WerkraumMedia\ThueCat\Domain\Model\Frontend\Offers;
/**
* @covers WerkraumMedia\ThueCat\Domain\Model\Frontend\Offers
* @covers \WerkraumMedia\ThueCat\Domain\Model\Frontend\Offers
*
* @uses \WerkraumMedia\ThueCat\Domain\Model\Frontend\Offer
* @uses \WerkraumMedia\ThueCat\Domain\Model\Frontend\Price
*
* @testdox Frontend model for offers
*/
class OffersTest extends TestCase

View file

@ -27,7 +27,10 @@ use PHPUnit\Framework\TestCase;
use WerkraumMedia\ThueCat\Domain\Model\Frontend\OpeningHours;
/**
* @covers WerkraumMedia\ThueCat\Domain\Model\Frontend\OpeningHours
* @covers \WerkraumMedia\ThueCat\Domain\Model\Frontend\OpeningHours
*
* @uses \WerkraumMedia\ThueCat\Domain\Model\Frontend\OpeningHour
*
* @testdox Frontend model for offers
*/
class OpeningHoursTest extends TestCase

View file

@ -27,7 +27,7 @@ use PHPUnit\Framework\TestCase;
use WerkraumMedia\ThueCat\Extension;
/**
* @covers WerkraumMedia\ThueCat\Extension
* @covers \WerkraumMedia\ThueCat\Extension
* @testdox The extension class
*/
class ExtensionTest extends TestCase