From ab6ef4ba48dd47110d4803d6260658eb53139ceb Mon Sep 17 00:00:00 2001 From: Ferdinand Kuhl Date: Sat, 30 Apr 2022 21:38:36 +0200 Subject: [PATCH 1/3] RUN phpcbf --- Classes/Command/SequenceCommandController.php | 2 +- Classes/Domain/Model/Insert.php | 8 ++++---- Classes/Service/SequenceGenerator.php | 9 ++++----- Migrations/Mysql/Version20140505093853.php | 1 - Migrations/Mysql/Version20160624203903.php | 1 - Tests/Functional/SequenceTest.php | 4 ++-- 6 files changed, 11 insertions(+), 14 deletions(-) diff --git a/Classes/Command/SequenceCommandController.php b/Classes/Command/SequenceCommandController.php index 076cd53..479120f 100644 --- a/Classes/Command/SequenceCommandController.php +++ b/Classes/Command/SequenceCommandController.php @@ -14,8 +14,8 @@ use Neos\Flow\Cli\CommandController; class SequenceCommandController extends CommandController { /** - * @var SequenceGenerator * @Flow\Inject + * @var SequenceGenerator */ protected $sequenceGenerator; diff --git a/Classes/Domain/Model/Insert.php b/Classes/Domain/Model/Insert.php index 6e95e41..c82e0af 100644 --- a/Classes/Domain/Model/Insert.php +++ b/Classes/Domain/Model/Insert.php @@ -16,16 +16,16 @@ use Neos\Flow\Annotations as Flow; class Insert { /** - * @var int * @Flow\Identity * @ORM\Id + * @var int */ protected $number; /** - * @var string * @Flow\Identity * @ORM\Id + * @var string */ protected $type; @@ -68,8 +68,8 @@ class Insert */ public function setType($type) { - if (is_object($type)) { - $type = get_class($type); + if (\is_object($type)) { + $type = \get_class($type); } $this->type = $type; } diff --git a/Classes/Service/SequenceGenerator.php b/Classes/Service/SequenceGenerator.php index ba8a0ea..9787f51 100644 --- a/Classes/Service/SequenceGenerator.php +++ b/Classes/Service/SequenceGenerator.php @@ -5,7 +5,6 @@ namespace DigiComp\Sequence\Service; use DigiComp\Sequence\Domain\Model\Insert; use Doctrine\Common\Persistence\ObjectManager; use Doctrine\DBAL\DBALException; -use Doctrine\ORM\EntityManager; use Neos\Flow\Annotations as Flow; use Neos\Flow\Log\SystemLoggerInterface; use Neos\Flow\Reflection\ReflectionService; @@ -22,21 +21,21 @@ use Neos\Utility\TypeHandling; class SequenceGenerator { /** - * @var ObjectManager * @Flow\Inject + * @var ObjectManager */ protected $entityManager; /** - * @var ReflectionService * @Flow\Inject * @deprecated + * @var ReflectionService */ protected $reflectionService; /** - * @var SystemLoggerInterface * @Flow\Inject + * @var SystemLoggerInterface */ protected $systemLogger; @@ -120,7 +119,7 @@ class SequenceGenerator */ protected function inferTypeFromSource($stringOrObject) { - if (is_object($stringOrObject)) { + if (\is_object($stringOrObject)) { $stringOrObject = TypeHandling::getTypeForValue($stringOrObject); } if (! $stringOrObject) { diff --git a/Migrations/Mysql/Version20140505093853.php b/Migrations/Mysql/Version20140505093853.php index 05b424e..5f54564 100644 --- a/Migrations/Mysql/Version20140505093853.php +++ b/Migrations/Mysql/Version20140505093853.php @@ -10,7 +10,6 @@ use Doctrine\DBAL\Schema\Schema; */ class Version20140505093853 extends AbstractMigration { - /** * @return string */ diff --git a/Migrations/Mysql/Version20160624203903.php b/Migrations/Mysql/Version20160624203903.php index 0d9ad16..cd2990f 100644 --- a/Migrations/Mysql/Version20160624203903.php +++ b/Migrations/Mysql/Version20160624203903.php @@ -10,7 +10,6 @@ use Doctrine\DBAL\Schema\Schema; */ class Version20160624203903 extends AbstractMigration { - /** * @return string */ diff --git a/Tests/Functional/SequenceTest.php b/Tests/Functional/SequenceTest.php index a4ec07a..7913837 100644 --- a/Tests/Functional/SequenceTest.php +++ b/Tests/Functional/SequenceTest.php @@ -25,7 +25,7 @@ class SequenceTest extends FunctionalTestCase $pIds = []; for ($i = 0; $i < 10; $i++) { - $pId = pcntl_fork(); + $pId = \pcntl_fork(); if ($pId) { $pIds[] = $pId; } else { @@ -39,7 +39,7 @@ class SequenceTest extends FunctionalTestCase foreach ($pIds as $pId) { $status = 0; - pcntl_waitpid($pId, $status); + \pcntl_waitpid($pId, $status); } $this->assertEquals(101, $sequenceGenerator->getLastNumberFor($sequenceGenerator)); From 8492f2f926a31effb801fcc96c5c684447adc7e0 Mon Sep 17 00:00:00 2001 From: Ferdinand Kuhl Date: Sat, 30 Apr 2022 21:45:57 +0200 Subject: [PATCH 2/3] Adding testing and code-style pipelines --- .woodpecker/code-style.yml | 7 ++++++ .woodpecker/test.yml | 46 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 .woodpecker/code-style.yml create mode 100644 .woodpecker/test.yml diff --git a/.woodpecker/code-style.yml b/.woodpecker/code-style.yml new file mode 100644 index 0000000..453df4b --- /dev/null +++ b/.woodpecker/code-style.yml @@ -0,0 +1,7 @@ +pipeline: + code-style: + image: composer + commands: + - composer global config repositories.repo-name vcs https://git.digital-competence.de/Packages/php-codesniffer + - composer global require digicomp/php-codesniffer:@dev + - composer global exec -- phpcs --runtime-set ignore_warnings_on_exit 1 --standard=DigiComp Classes/ Migrations/ Tests/ Resources/Private/ diff --git a/.woodpecker/test.yml b/.woodpecker/test.yml new file mode 100644 index 0000000..cd71c34 --- /dev/null +++ b/.woodpecker/test.yml @@ -0,0 +1,46 @@ +workspace: + base: /woodpecker + path: package + +matrix: + FLOW_VERSION: + - 4.3 + - 5.3 + +pipeline: + functional-tests: + image: thecodingmachine/php:7.4-v4-cli + environment: + # Enable the PDO_SQLITE extension + - "PHP_EXTENSION_PDO_SQLITE=1" + - "FLOW_VERSION=${FLOW_VERSION}" + - "NEOS_BUILD_DIR=/woodpecker/Build-${FLOW_VERSION}" + commands: + - "sudo mkdir $NEOS_BUILD_DIR" + - "sudo chown -R docker:docker $NEOS_BUILD_DIR" + - "cd $NEOS_BUILD_DIR" + - "if [ \"$FLOW_VERSION\" = \"4.3\" ]; then sudo composer self-update --1; fi" + - "composer create-project --no-install neos/flow-base-distribution:^$FLOW_VERSION ." + - "composer config repositories.repo-name path /woodpecker/package" + - "composer remove --dev neos/behat" + - "if [ \"$FLOW_VERSION\" = \"4.3\" ]; then composer require typo3fluid/fluid:2.4.3; fi" + - "composer require digicomp/sequence:@dev" + - | + if [ "$FLOW_VERSION" = "4.3" ]; then + echo 'Neos: + Flow: + persistence: + backendOptions: + dbname: "flow_functional_testing" + error: + errorHandler: + exceptionalErrors: + 0: "%E_USER_ERROR%" + 1: "%E_RECOVERABLE_ERROR%" + 2: ~ + 3: "%E_NOTICE%" + 4: "%E_USER_WARNING%" + 5: "%E_USER_NOTICE%" + 6: "%E_STRICT%"' > Configuration/Testing/Settings.yaml + fi + - "bin/phpunit --configuration Build/BuildEssentials/PhpUnit/FunctionalTests.xml Packages/Application/DigiComp.Sequence/Tests/Functional" From c74da756a6c09330fc47dec1a7d44017a0a6a1d4 Mon Sep 17 00:00:00 2001 From: Ferdinand Kuhl Date: Sat, 30 Apr 2022 21:48:56 +0200 Subject: [PATCH 3/3] Adjusting tests to work with flow 5.3 and 6.3 --- .woodpecker/test.yml | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/.woodpecker/test.yml b/.woodpecker/test.yml index cd71c34..8d5107f 100644 --- a/.woodpecker/test.yml +++ b/.woodpecker/test.yml @@ -4,8 +4,8 @@ workspace: matrix: FLOW_VERSION: - - 4.3 - 5.3 + - 6.3 pipeline: functional-tests: @@ -19,28 +19,8 @@ pipeline: - "sudo mkdir $NEOS_BUILD_DIR" - "sudo chown -R docker:docker $NEOS_BUILD_DIR" - "cd $NEOS_BUILD_DIR" - - "if [ \"$FLOW_VERSION\" = \"4.3\" ]; then sudo composer self-update --1; fi" - "composer create-project --no-install neos/flow-base-distribution:^$FLOW_VERSION ." - "composer config repositories.repo-name path /woodpecker/package" - "composer remove --dev neos/behat" - - "if [ \"$FLOW_VERSION\" = \"4.3\" ]; then composer require typo3fluid/fluid:2.4.3; fi" - "composer require digicomp/sequence:@dev" - - | - if [ "$FLOW_VERSION" = "4.3" ]; then - echo 'Neos: - Flow: - persistence: - backendOptions: - dbname: "flow_functional_testing" - error: - errorHandler: - exceptionalErrors: - 0: "%E_USER_ERROR%" - 1: "%E_RECOVERABLE_ERROR%" - 2: ~ - 3: "%E_NOTICE%" - 4: "%E_USER_WARNING%" - 5: "%E_USER_NOTICE%" - 6: "%E_STRICT%"' > Configuration/Testing/Settings.yaml - fi - "bin/phpunit --configuration Build/BuildEssentials/PhpUnit/FunctionalTests.xml Packages/Application/DigiComp.Sequence/Tests/Functional"