From e604b848499e9648cbf336abf0c6945e32c89855 Mon Sep 17 00:00:00 2001 From: Daniel Seifert Date: Mon, 20 Dec 2021 13:41:24 +0100 Subject: [PATCH] improve code --- .../Controller/Admin/d3ActionWizard.php | 10 ++----- .../Controller/Admin/d3ExportWizard.php | 4 +-- Application/Model/ActionBase.php | 2 +- Application/Model/Configuration.php | 4 --- Application/Model/ExportBase.php | 7 +++-- Application/Model/ExportRenderer/Csv.php | 4 +-- Application/Model/ExportRenderer/Pretty.php | 2 +- .../Model/ExportRenderer/RendererBridge.php | 2 +- tests/d3datawizard_config.php | 2 +- tests/tools/d3TestExport.php | 2 +- .../unit/Application/Model/ActionBaseTest.php | 2 +- .../Application/Model/ConfigurationTest.php | 29 ++++++++++--------- .../Model/Exceptions/DebugExceptionTest.php | 6 ++-- .../Exceptions/ExportFileExceptionTest.php | 6 ++-- .../Exceptions/InputUnvalidExceptionTest.php | 7 +++-- .../NoSuitableRendererExceptionTest.php | 6 ++-- .../Model/Exceptions/TaskExceptionTest.php | 6 ++-- .../unit/Application/Model/ExportBaseTest.php | 2 +- .../Model/ExportRenderer/CsvTest.php | 27 ++++++++--------- .../ExportRenderer/ExportRendererTest.php | 5 ++-- .../Model/ExportRenderer/JsonTest.php | 3 +- .../Model/ExportRenderer/PrettyTest.php | 5 ++-- .../ExportRenderer/RendererBridgeTest.php | 9 +++--- 23 files changed, 77 insertions(+), 75 deletions(-) diff --git a/Application/Controller/Admin/d3ActionWizard.php b/Application/Controller/Admin/d3ActionWizard.php index c15ec84..1c2b007 100644 --- a/Application/Controller/Admin/d3ActionWizard.php +++ b/Application/Controller/Admin/d3ActionWizard.php @@ -19,14 +19,11 @@ use D3\DataWizard\Application\Model\Configuration; use D3\DataWizard\Application\Model\Exceptions\DataWizardException; use D3\DataWizard\Application\Model\Exceptions\DebugException; use D3\ModCfg\Application\Model\d3database; -use D3\ModCfg\Application\Model\Exception\d3_cfg_mod_exception; -use D3\ModCfg\Application\Model\Exception\d3ShopCompatibilityAdapterException; use Doctrine\DBAL\DBALException; use OxidEsales\Eshop\Application\Controller\Admin\AdminDetailsController; use OxidEsales\Eshop\Core\Config; use OxidEsales\Eshop\Core\Exception\DatabaseConnectionException; use OxidEsales\Eshop\Core\Exception\DatabaseErrorException; -use OxidEsales\Eshop\Core\Exception\StandardException; use OxidEsales\Eshop\Core\Registry; class d3ActionWizard extends AdminDetailsController @@ -43,7 +40,7 @@ class d3ActionWizard extends AdminDetailsController $this->configuration = oxNew(Configuration::class); } - public function getGroups() + public function getGroups(): array { return $this->configuration->getActionGroups(); } @@ -55,9 +52,6 @@ class d3ActionWizard extends AdminDetailsController /** * @throws DatabaseConnectionException - * @throws StandardException - * @throws d3ShopCompatibilityAdapterException - * @throws d3_cfg_mod_exception */ public function runTask() { @@ -93,7 +87,7 @@ class d3ActionWizard extends AdminDetailsController /** * @return Config */ - public function d3GetConfig() + public function d3GetConfig(): Config { return Registry::getConfig(); } diff --git a/Application/Controller/Admin/d3ExportWizard.php b/Application/Controller/Admin/d3ExportWizard.php index 049a24e..e506393 100644 --- a/Application/Controller/Admin/d3ExportWizard.php +++ b/Application/Controller/Admin/d3ExportWizard.php @@ -45,7 +45,7 @@ class d3ExportWizard extends AdminDetailsController $this->configuration = oxNew(Configuration::class); } - public function getGroups() + public function getGroups(): array { return $this->configuration->getExportGroups(); } @@ -101,7 +101,7 @@ class d3ExportWizard extends AdminDetailsController /** * @return Config */ - public function d3GetConfig() + public function d3GetConfig(): Config { return Registry::getConfig(); } diff --git a/Application/Model/ActionBase.php b/Application/Model/ActionBase.php index 5bb651c..c31cb41 100644 --- a/Application/Model/ActionBase.php +++ b/Application/Model/ActionBase.php @@ -95,7 +95,7 @@ abstract class ActionBase implements QueryBase * @return DatabaseInterface|null * @throws DatabaseConnectionException */ - public function d3GetDb() + public function d3GetDb(): ?DatabaseInterface { return DatabaseProvider::getDb( DatabaseProvider::FETCH_MODE_ASSOC ); } diff --git a/Application/Model/Configuration.php b/Application/Model/Configuration.php index 90208c5..051155b 100644 --- a/Application/Model/Configuration.php +++ b/Application/Model/Configuration.php @@ -15,11 +15,7 @@ declare(strict_types=1); namespace D3\DataWizard\Application\Model; -use D3\DataWizard\Application\Model\Actions\FixArtextendsItems; use D3\DataWizard\Application\Model\Exceptions\DataWizardException; -use D3\DataWizard\Application\Model\Exports\InactiveCategories; -use D3\DataWizard\Application\Model\Exports\KeyFigures; -use OxidEsales\Eshop\Core\Registry; class Configuration { diff --git a/Application/Model/ExportBase.php b/Application/Model/ExportBase.php index 02c0eab..9ead1e5 100644 --- a/Application/Model/ExportBase.php +++ b/Application/Model/ExportBase.php @@ -25,6 +25,7 @@ use Doctrine\DBAL\DBALException; use FormManager\Inputs\Checkbox; use FormManager\Inputs\Input; use FormManager\Inputs\Radio; +use OxidEsales\Eshop\Core\Database\Adapter\DatabaseInterface; use OxidEsales\Eshop\Core\DatabaseProvider; use OxidEsales\Eshop\Core\Exception\DatabaseConnectionException; use OxidEsales\Eshop\Core\Exception\DatabaseErrorException; @@ -94,7 +95,7 @@ abstract class ExportBase implements QueryBase /** * @return RendererBridge */ - public function getRendererBridge() + public function getRendererBridge(): RendererBridge { return oxNew(RendererBridge::class); } @@ -244,10 +245,10 @@ abstract class ExportBase implements QueryBase } /** - * @return \OxidEsales\Eshop\Core\Database\Adapter\DatabaseInterface|null + * @return DatabaseInterface|null * @throws DatabaseConnectionException */ - protected function d3GetDb(): ?\OxidEsales\Eshop\Core\Database\Adapter\DatabaseInterface + protected function d3GetDb(): ?DatabaseInterface { return DatabaseProvider::getDb(DatabaseProvider::FETCH_MODE_ASSOC); } diff --git a/Application/Model/ExportRenderer/Csv.php b/Application/Model/ExportRenderer/Csv.php index 38f38b6..696e1e8 100644 --- a/Application/Model/ExportRenderer/Csv.php +++ b/Application/Model/ExportRenderer/Csv.php @@ -37,7 +37,7 @@ class Csv implements RendererInterface $csv = $this->getCsv(); $csv->insertOne( $fieldNames ); $csv->insertAll( $rows ); - return method_exists($csv, 'getContent') ? $csv->getContent() : (string) $csv; + return (string) $csv; } catch (Exception $e) { /** @var RenderException $newException */ $newException = oxNew(RenderException::class, $e->getMessage(), $e->getCode(), $e ); @@ -86,7 +86,7 @@ class Csv implements RendererInterface /** * @return Config */ - public function d3GetConfig() + public function d3GetConfig(): Config { return Registry::getConfig(); } diff --git a/Application/Model/ExportRenderer/Pretty.php b/Application/Model/ExportRenderer/Pretty.php index 8700d2f..f8fa5fc 100644 --- a/Application/Model/ExportRenderer/Pretty.php +++ b/Application/Model/ExportRenderer/Pretty.php @@ -35,7 +35,7 @@ class Pretty implements RendererInterface * @param $rows * @return ArrayToTextTable */ - public function getArrayToTextTableInstance($rows) + public function getArrayToTextTableInstance($rows): ArrayToTextTable { return oxNew(ArrayToTextTable::class, $rows); } diff --git a/Application/Model/ExportRenderer/RendererBridge.php b/Application/Model/ExportRenderer/RendererBridge.php index a5f43b3..2be4580 100644 --- a/Application/Model/ExportRenderer/RendererBridge.php +++ b/Application/Model/ExportRenderer/RendererBridge.php @@ -35,7 +35,7 @@ class RendererBridge ]; } - public function getTranslatedRendererIdList() + public function getTranslatedRendererIdList(): array { $rendererList = $this->getRendererList(); array_walk($rendererList, [$this, 'translateRendererId']); diff --git a/tests/d3datawizard_config.php b/tests/d3datawizard_config.php index e4e6aab..a016eb0 100755 --- a/tests/d3datawizard_config.php +++ b/tests/d3datawizard_config.php @@ -11,5 +11,5 @@ * @link https://www.oxidmodule.com */ -define('D3DATAWIZARD_REQUIRE_MODCFG', true); +const D3DATAWIZARD_REQUIRE_MODCFG = true; diff --git a/tests/tools/d3TestExport.php b/tests/tools/d3TestExport.php index 5143576..7b82031 100644 --- a/tests/tools/d3TestExport.php +++ b/tests/tools/d3TestExport.php @@ -13,6 +13,6 @@ class d3TestExport extends ExportBase public function getQuery(): array { - return "SELECT 1"; + return ["SELECT 1"]; } } \ No newline at end of file diff --git a/tests/unit/Application/Model/ActionBaseTest.php b/tests/unit/Application/Model/ActionBaseTest.php index cedc94b..fe0db2d 100644 --- a/tests/unit/Application/Model/ActionBaseTest.php +++ b/tests/unit/Application/Model/ActionBaseTest.php @@ -94,7 +94,7 @@ class ActionBaseTest extends d3ModCfgUnitTestCase ); } - public function canGetHasFormElementsDataProvider() + public function canGetHasFormElementsDataProvider(): array { return [ 'hasFormElements' => [['abc', 'def'], true], diff --git a/tests/unit/Application/Model/ConfigurationTest.php b/tests/unit/Application/Model/ConfigurationTest.php index 1d8d163..9bad962 100644 --- a/tests/unit/Application/Model/ConfigurationTest.php +++ b/tests/unit/Application/Model/ConfigurationTest.php @@ -21,6 +21,7 @@ use D3\DataWizard\tests\tools\d3TestAction; use D3\DataWizard\tests\tools\d3TestExport; use D3\ModCfg\Tests\unit\d3ModCfgUnitTestCase; use PHPUnit\Framework\MockObject\MockObject; +use ReflectionException; class ConfigurationTest extends d3ModCfgUnitTestCase { @@ -44,7 +45,7 @@ class ConfigurationTest extends d3ModCfgUnitTestCase /** * @covers \D3\DataWizard\Application\Model\Configuration::__construct * @test - * @throws \ReflectionException + * @throws ReflectionException */ public function canConstruct() { @@ -65,7 +66,7 @@ class ConfigurationTest extends d3ModCfgUnitTestCase /** * @covers \D3\DataWizard\Application\Model\Configuration::configure() * @test - * @throws \ReflectionException + * @throws ReflectionException */ public function canConfigure() { @@ -80,7 +81,7 @@ class ConfigurationTest extends d3ModCfgUnitTestCase /** * @covers \D3\DataWizard\Application\Model\Configuration::registerAction * @test - * @throws \ReflectionException + * @throws ReflectionException */ public function canRegisterAction() { @@ -113,7 +114,7 @@ class ConfigurationTest extends d3ModCfgUnitTestCase /** * @covers \D3\DataWizard\Application\Model\Configuration::registerExport * @test - * @throws \ReflectionException + * @throws ReflectionException */ public function canRegisterExport() { @@ -166,7 +167,7 @@ class ConfigurationTest extends d3ModCfgUnitTestCase /** * @covers \D3\DataWizard\Application\Model\Configuration::getGroupedActions() * @test - * @throws \ReflectionException + * @throws ReflectionException */ public function canGetGroupedActions() { @@ -190,7 +191,7 @@ class ConfigurationTest extends d3ModCfgUnitTestCase /** * @covers \D3\DataWizard\Application\Model\Configuration::getGroupedExports() * @test - * @throws \ReflectionException + * @throws ReflectionException */ public function canGetGroupedExports() { @@ -214,7 +215,7 @@ class ConfigurationTest extends d3ModCfgUnitTestCase /** * @covers \D3\DataWizard\Application\Model\Configuration::getActionGroups() * @test - * @throws \ReflectionException + * @throws ReflectionException */ public function canGetActionGroups() { @@ -238,7 +239,7 @@ class ConfigurationTest extends d3ModCfgUnitTestCase /** * @covers \D3\DataWizard\Application\Model\Configuration::getExportGroups() * @test - * @throws \ReflectionException + * @throws ReflectionException */ public function canGetExportGroups() { @@ -262,7 +263,7 @@ class ConfigurationTest extends d3ModCfgUnitTestCase /** * @covers \D3\DataWizard\Application\Model\Configuration::getActionsByGroup() * @test - * @throws \ReflectionException + * @throws ReflectionException */ public function canGetActionsByGroup() { @@ -287,7 +288,7 @@ class ConfigurationTest extends d3ModCfgUnitTestCase /** * @covers \D3\DataWizard\Application\Model\Configuration::getExportsByGroup() * @test - * @throws \ReflectionException + * @throws ReflectionException */ public function canGetExportsByGroup() { @@ -312,7 +313,7 @@ class ConfigurationTest extends d3ModCfgUnitTestCase /** * @covers \D3\DataWizard\Application\Model\Configuration::getAllActions() * @test - * @throws \ReflectionException + * @throws ReflectionException */ public function canGetAllActions() { @@ -343,7 +344,7 @@ class ConfigurationTest extends d3ModCfgUnitTestCase /** * @covers \D3\DataWizard\Application\Model\Configuration::getAllExports() * @test - * @throws \ReflectionException + * @throws ReflectionException */ public function canGetAllExports() { @@ -374,7 +375,7 @@ class ConfigurationTest extends d3ModCfgUnitTestCase /** * @covers \D3\DataWizard\Application\Model\Configuration::getActionById() * @test - * @throws \ReflectionException + * @throws ReflectionException * @dataProvider canGetActionByIdDataProvider */ public function canGetActionById($id, $throwException) @@ -409,7 +410,7 @@ class ConfigurationTest extends d3ModCfgUnitTestCase /** * @covers \D3\DataWizard\Application\Model\Configuration::getExportById() * @test - * @throws \ReflectionException + * @throws ReflectionException * @dataProvider canGetActionByIdDataProvider */ public function canGetExportById($id, $throwException) diff --git a/tests/unit/Application/Model/Exceptions/DebugExceptionTest.php b/tests/unit/Application/Model/Exceptions/DebugExceptionTest.php index 779db2f..cd70716 100644 --- a/tests/unit/Application/Model/Exceptions/DebugExceptionTest.php +++ b/tests/unit/Application/Model/Exceptions/DebugExceptionTest.php @@ -17,7 +17,9 @@ namespace D3\DataWizard\tests\unit\Application\Model\Exceptions; use D3\DataWizard\Application\Model\Exceptions\DebugException; use D3\ModCfg\Tests\unit\d3ModCfgUnitTestCase; +use Exception; use PHPUnit\Framework\MockObject\MockObject; +use ReflectionException; class DebugExceptionTest extends d3ModCfgUnitTestCase { @@ -27,13 +29,13 @@ class DebugExceptionTest extends d3ModCfgUnitTestCase /** * @covers \D3\DataWizard\Application\Model\Exceptions\DebugException::__construct * @test - * @throws \ReflectionException + * @throws ReflectionException */ public function canConstruct() { $code = '500'; - $exception = oxNew(\Exception::class); + $exception = oxNew( Exception::class); /** @var DebugException|MockObject $modelMock */ $modelMock = $this->getMockBuilder(DebugException::class) diff --git a/tests/unit/Application/Model/Exceptions/ExportFileExceptionTest.php b/tests/unit/Application/Model/Exceptions/ExportFileExceptionTest.php index be6d83e..2fa6dc9 100644 --- a/tests/unit/Application/Model/Exceptions/ExportFileExceptionTest.php +++ b/tests/unit/Application/Model/Exceptions/ExportFileExceptionTest.php @@ -17,7 +17,9 @@ namespace D3\DataWizard\tests\unit\Application\Model\Exceptions; use D3\DataWizard\Application\Model\Exceptions\ExportFileException; use D3\ModCfg\Tests\unit\d3ModCfgUnitTestCase; +use Exception; use PHPUnit\Framework\MockObject\MockObject; +use ReflectionException; class ExportFileExceptionTest extends d3ModCfgUnitTestCase { @@ -27,13 +29,13 @@ class ExportFileExceptionTest extends d3ModCfgUnitTestCase /** * @covers \D3\DataWizard\Application\Model\Exceptions\ExportFileException::__construct * @test - * @throws \ReflectionException + * @throws ReflectionException */ public function canConstruct() { $code = '500'; - $exception = oxNew(\Exception::class); + $exception = oxNew( Exception::class); /** @var ExportFileException|MockObject $modelMock */ $modelMock = $this->getMockBuilder(ExportFileException::class) diff --git a/tests/unit/Application/Model/Exceptions/InputUnvalidExceptionTest.php b/tests/unit/Application/Model/Exceptions/InputUnvalidExceptionTest.php index 2dfe869..b8e0a0f 100644 --- a/tests/unit/Application/Model/Exceptions/InputUnvalidExceptionTest.php +++ b/tests/unit/Application/Model/Exceptions/InputUnvalidExceptionTest.php @@ -19,8 +19,10 @@ use D3\DataWizard\Application\Model\Exceptions\InputUnvalidException; use D3\DataWizard\Application\Model\ExportBase; use D3\DataWizard\tests\tools\d3TestExport; use D3\ModCfg\Tests\unit\d3ModCfgUnitTestCase; +use Exception; use FormManager\Inputs\Number; use PHPUnit\Framework\MockObject\MockObject; +use ReflectionException; class InputUnvalidExceptionTest extends d3ModCfgUnitTestCase { @@ -30,15 +32,14 @@ class InputUnvalidExceptionTest extends d3ModCfgUnitTestCase /** * @covers \D3\DataWizard\Application\Model\Exceptions\InputUnvalidException::__construct * @test - * @throws \ReflectionException + * @throws ReflectionException */ public function canConstruct() { $code = '500'; - $exception = oxNew(\Exception::class); + $exception = oxNew( Exception::class); - /** @var Number $invalidField */ $invalidField = new Number(null, [ 'required' => true, 'min' => 1, diff --git a/tests/unit/Application/Model/Exceptions/NoSuitableRendererExceptionTest.php b/tests/unit/Application/Model/Exceptions/NoSuitableRendererExceptionTest.php index 49e34b0..b44d9db 100644 --- a/tests/unit/Application/Model/Exceptions/NoSuitableRendererExceptionTest.php +++ b/tests/unit/Application/Model/Exceptions/NoSuitableRendererExceptionTest.php @@ -17,7 +17,9 @@ namespace D3\DataWizard\tests\unit\Application\Model\Exceptions; use D3\DataWizard\Application\Model\Exceptions\NoSuitableRendererException; use D3\ModCfg\Tests\unit\d3ModCfgUnitTestCase; +use Exception; use PHPUnit\Framework\MockObject\MockObject; +use ReflectionException; class NoSuitableRendererExceptionTest extends d3ModCfgUnitTestCase { @@ -27,13 +29,13 @@ class NoSuitableRendererExceptionTest extends d3ModCfgUnitTestCase /** * @covers \D3\DataWizard\Application\Model\Exceptions\NoSuitableRendererException::__construct * @test - * @throws \ReflectionException + * @throws ReflectionException */ public function canConstruct() { $code = '500'; - $exception = oxNew(\Exception::class); + $exception = oxNew( Exception::class); /** @var NoSuitableRendererException|MockObject $modelMock */ $modelMock = $this->getMockBuilder(NoSuitableRendererException::class) diff --git a/tests/unit/Application/Model/Exceptions/TaskExceptionTest.php b/tests/unit/Application/Model/Exceptions/TaskExceptionTest.php index f9d5cd4..4cb4840 100644 --- a/tests/unit/Application/Model/Exceptions/TaskExceptionTest.php +++ b/tests/unit/Application/Model/Exceptions/TaskExceptionTest.php @@ -19,7 +19,9 @@ use D3\DataWizard\Application\Model\Exceptions\TaskException; use D3\DataWizard\Application\Model\ExportBase; use D3\DataWizard\tests\tools\d3TestExport; use D3\ModCfg\Tests\unit\d3ModCfgUnitTestCase; +use Exception; use PHPUnit\Framework\MockObject\MockObject; +use ReflectionException; class TaskExceptionTest extends d3ModCfgUnitTestCase { @@ -29,13 +31,13 @@ class TaskExceptionTest extends d3ModCfgUnitTestCase /** * @covers \D3\DataWizard\Application\Model\Exceptions\TaskException::__construct * @test - * @throws \ReflectionException + * @throws ReflectionException */ public function canConstruct() { $code = '500'; - $exception = oxNew(\Exception::class); + $exception = oxNew( Exception::class); /** @var ExportBase|MockObject $taskMock */ $taskMock = $this->getMockBuilder(d3TestExport::class) diff --git a/tests/unit/Application/Model/ExportBaseTest.php b/tests/unit/Application/Model/ExportBaseTest.php index e486956..854e82e 100644 --- a/tests/unit/Application/Model/ExportBaseTest.php +++ b/tests/unit/Application/Model/ExportBaseTest.php @@ -99,7 +99,7 @@ class ExportBaseTest extends d3ModCfgUnitTestCase ); } - public function canGetHasFormElementsDataProvider() + public function canGetHasFormElementsDataProvider(): array { return [ 'hasFormElements' => [['abc', 'def'], true], diff --git a/tests/unit/Application/Model/ExportRenderer/CsvTest.php b/tests/unit/Application/Model/ExportRenderer/CsvTest.php index 2968a1b..f61382a 100644 --- a/tests/unit/Application/Model/ExportRenderer/CsvTest.php +++ b/tests/unit/Application/Model/ExportRenderer/CsvTest.php @@ -22,6 +22,7 @@ use League\Csv\Writer; use OxidEsales\Eshop\Core\Config; use OxidEsales\Eshop\Core\Registry; use PHPUnit\Framework\MockObject\MockObject; +use ReflectionException; class CsvTest extends ExportRendererTest { @@ -38,7 +39,7 @@ class CsvTest extends ExportRendererTest /** * @covers \D3\DataWizard\Application\Model\ExportRenderer\Csv::getContent * @test - * @throws \ReflectionException + * @throws ReflectionException * @dataProvider canGetContentDataProvider */ public function canGetContent($blThrowException) @@ -48,25 +49,21 @@ class CsvTest extends ExportRendererTest $valueList = ['value1', 'value2']; /** @var Writer|MockObject $csvMock */ - $csvMockBuilder = $this->getMockBuilder(Writer::class); + $csvMockBuilder = $this->getMockBuilder( Writer::class); $csvMockBuilder->disableOriginalConstructor(); - $onlyMethods = ['insertOne', 'insertAll']; - if (method_exists($csvMockBuilder->getMock(), 'getContent')) { - $onlyMethods[] = 'getContent'; - } else { - $csvMockBuilder->addMethods(['getContent']); - } + $onlyMethods = ['__toString', 'insertOne', 'insertAll']; $csvMockBuilder->onlyMethods($onlyMethods); $csvMock = $csvMockBuilder->getMock(); + $csvMock->method('insertOne')->willReturn(1); + $csvMock->method('insertAll')->willReturn(1); + if ($blThrowException) { - $csvMock->expects($this->atLeastOnce())->method('getContent')->willThrowException(oxNew(Exception::class)); + $csvMock->expects($this->atLeastOnce())->method('__toString')->willThrowException(oxNew(Exception::class)); $this->expectException(RenderException::class); } else { - $csvMock->expects($this->atLeastOnce())->method('getContent')->willReturn($expected); + $csvMock->expects($this->atLeastOnce())->method('__toString')->willReturn($expected); } - $csvMock->expects($this->atLeastOnce())->method('insertOne')->with($fieldList)->willReturn(1); - $csvMock->expects($this->atLeastOnce())->method('insertAll')->with($valueList)->willReturn(1); /** @var Csv|MockObject $modelMock */ $modelMock = $this->getMockBuilder(Csv::class) @@ -99,7 +96,7 @@ class CsvTest extends ExportRendererTest /** * @covers \D3\DataWizard\Application\Model\ExportRenderer\Csv::getCsv * @test - * @throws \ReflectionException + * @throws ReflectionException */ public function canGetCsv() { @@ -115,7 +112,7 @@ class CsvTest extends ExportRendererTest /** * @covers \D3\DataWizard\Application\Model\ExportRenderer\Csv::getCsv * @test - * @throws \ReflectionException + * @throws ReflectionException */ public function canGetCsvNoSettings() { @@ -165,7 +162,7 @@ class CsvTest extends ExportRendererTest /** * @covers \D3\DataWizard\Application\Model\ExportRenderer\Csv::d3GetConfig * @test - * @throws \ReflectionException + * @throws ReflectionException */ public function canGetConfig() { diff --git a/tests/unit/Application/Model/ExportRenderer/ExportRendererTest.php b/tests/unit/Application/Model/ExportRenderer/ExportRendererTest.php index f89dede..cf77a04 100644 --- a/tests/unit/Application/Model/ExportRenderer/ExportRendererTest.php +++ b/tests/unit/Application/Model/ExportRenderer/ExportRendererTest.php @@ -15,6 +15,7 @@ namespace D3\DataWizard\tests\unit\Application\Model\ExportRenderer; use D3\DataWizard\Application\Model\ExportRenderer\RendererInterface; use D3\ModCfg\Tests\unit\d3ModCfgUnitTestCase; +use ReflectionException; abstract class ExportRendererTest extends d3ModCfgUnitTestCase { @@ -33,7 +34,7 @@ abstract class ExportRendererTest extends d3ModCfgUnitTestCase * @covers \D3\DataWizard\Application\Model\ExportRenderer\Json::getFileExtension * @covers \D3\DataWizard\Application\Model\ExportRenderer\Pretty::getFileExtension * @test - * @throws \ReflectionException + * @throws ReflectionException */ public function canGetFileExtension() { @@ -51,7 +52,7 @@ abstract class ExportRendererTest extends d3ModCfgUnitTestCase * @covers \D3\DataWizard\Application\Model\ExportRenderer\Json::getTitleTranslationId * @covers \D3\DataWizard\Application\Model\ExportRenderer\Pretty::getTitleTranslationId * @test - * @throws \ReflectionException + * @throws ReflectionException */ public function canGetTitleTranslationId() { diff --git a/tests/unit/Application/Model/ExportRenderer/JsonTest.php b/tests/unit/Application/Model/ExportRenderer/JsonTest.php index 413aa80..05d7156 100644 --- a/tests/unit/Application/Model/ExportRenderer/JsonTest.php +++ b/tests/unit/Application/Model/ExportRenderer/JsonTest.php @@ -17,6 +17,7 @@ namespace D3\DataWizard\tests\unit\Application\Model\ExportRenderer; use D3\DataWizard\Application\Model\Exceptions\RenderException; use D3\DataWizard\Application\Model\ExportRenderer\Json; +use ReflectionException; class JsonTest extends ExportRendererTest { @@ -33,7 +34,7 @@ class JsonTest extends ExportRendererTest /** * @covers \D3\DataWizard\Application\Model\ExportRenderer\Json::getContent * @test - * @throws \ReflectionException + * @throws ReflectionException * @dataProvider canGetContentDataProvider */ public function canGetContent($valueList, $expectException) diff --git a/tests/unit/Application/Model/ExportRenderer/PrettyTest.php b/tests/unit/Application/Model/ExportRenderer/PrettyTest.php index 481d9ec..5a41d0d 100644 --- a/tests/unit/Application/Model/ExportRenderer/PrettyTest.php +++ b/tests/unit/Application/Model/ExportRenderer/PrettyTest.php @@ -18,6 +18,7 @@ namespace D3\DataWizard\tests\unit\Application\Model\ExportRenderer; use D3\DataWizard\Application\Model\ExportRenderer\Pretty; use MathieuViossat\Util\ArrayToTextTable; use PHPUnit\Framework\MockObject\MockObject; +use ReflectionException; class PrettyTest extends ExportRendererTest { @@ -34,7 +35,7 @@ class PrettyTest extends ExportRendererTest /** * @covers \D3\DataWizard\Application\Model\ExportRenderer\Pretty::getContent * @test - * @throws \ReflectionException + * @throws ReflectionException */ public function canGetContent() { @@ -69,7 +70,7 @@ class PrettyTest extends ExportRendererTest /** * @covers \D3\DataWizard\Application\Model\ExportRenderer\Pretty::getArrayToTextTableInstance * @test - * @throws \ReflectionException + * @throws ReflectionException */ public function canGetArrayToTextTableInstance() { diff --git a/tests/unit/Application/Model/ExportRenderer/RendererBridgeTest.php b/tests/unit/Application/Model/ExportRenderer/RendererBridgeTest.php index c7c5c07..7d87f2d 100644 --- a/tests/unit/Application/Model/ExportRenderer/RendererBridgeTest.php +++ b/tests/unit/Application/Model/ExportRenderer/RendererBridgeTest.php @@ -23,6 +23,7 @@ use D3\DataWizard\Application\Model\ExportRenderer\RendererBridge; use D3\DataWizard\Application\Model\ExportRenderer\RendererInterface; use D3\ModCfg\Tests\unit\d3ModCfgUnitTestCase; use PHPUnit\Framework\MockObject\MockObject; +use ReflectionException; class RendererBridgeTest extends d3ModCfgUnitTestCase { @@ -46,7 +47,7 @@ class RendererBridgeTest extends d3ModCfgUnitTestCase /** * @covers \D3\DataWizard\Application\Model\ExportRenderer\RendererBridge::getRendererList * @test - * @throws \ReflectionException + * @throws ReflectionException */ public function canGetRendererList() { @@ -62,7 +63,7 @@ class RendererBridgeTest extends d3ModCfgUnitTestCase /** * @covers \D3\DataWizard\Application\Model\ExportRenderer\RendererBridge::getTranslatedRendererIdList * @test - * @throws \ReflectionException + * @throws ReflectionException */ public function canGetTranslatedRendererIdList() { @@ -84,7 +85,7 @@ class RendererBridgeTest extends d3ModCfgUnitTestCase /** * @covers \D3\DataWizard\Application\Model\ExportRenderer\RendererBridge::translateRendererId * @test - * @throws \ReflectionException + * @throws ReflectionException */ public function canTranslateRendererId() { @@ -108,7 +109,7 @@ class RendererBridgeTest extends d3ModCfgUnitTestCase * @test * @param $format * @param $blThrowException - * @throws \ReflectionException + * @throws ReflectionException * @dataProvider canGetRendererDataProvider */ public function canGetRenderer($format, $blThrowException)