diff --git a/.env.example b/.env.example index 8d96b93..3cb636c 100644 --- a/.env.example +++ b/.env.example @@ -1,3 +1,3 @@ GITHUB_TOKEN= -PHP_VERSION=56|73|74|80 +PHP_VERSION=56|73|74|80|81|82|83 DB_ENGINE= \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 96f5f90..883b73f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,11 +12,11 @@ jobs: test: strategy: matrix: - PHP: [56, 73, 74, 80, 81] + PHP: [56, 74, 80, 81, 82, 83] runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Prepare code env: @@ -28,21 +28,21 @@ jobs: - name: Prepare environment run: | - docker-compose up -d + docker compose up -d echo $(docker run -t --network github jwilder/dockerize -wait tcp://php:9000 -timeout 120s) - docker-compose ps - docker-compose logs php + docker compose ps + docker compose logs php - name: Run PHP Unit run: | - docker-compose exec -T php composer test + docker compose exec -T php composer test - name: Run PHP Stan if: matrix.PHP != '56' run: | - docker-compose exec -T php composer analyse + docker compose exec -T php composer analyse - name: Run PHP CS Fixer if: matrix.PHP != '56' run: | - docker-compose exec -T php composer fix:ci \ No newline at end of file + docker compose exec -T php composer fix:ci \ No newline at end of file diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php index 0d7bd20..52918dd 100644 --- a/.php-cs-fixer.php +++ b/.php-cs-fixer.php @@ -1,7 +1,7 @@ true, + '@PSR12' => true, 'array_syntax' => ['syntax' => 'short'], 'multiline_whitespace_before_semicolons' => false, 'echo_tag_syntax' => false, @@ -22,10 +22,11 @@ 'ternary_operator_spaces' => true, 'trailing_comma_in_multiline' => true, 'trim_array_spaces' => true, - 'braces' => [ - 'allow_single_line_closure' => true, - 'position_after_functions_and_oop_constructs' => 'same', + 'curly_braces_position' => [ + 'classes_opening_brace' => 'same_line', + 'functions_opening_brace' => 'same_line', ], + 'visibility_required' => ['elements' => ['property', 'method']], ]; $excludes = [ diff --git a/src/Phinx.php b/src/Phinx.php index 52ff469..7d02a54 100644 --- a/src/Phinx.php +++ b/src/Phinx.php @@ -13,23 +13,35 @@ public function _before(TestInterface $test) { $populate = $this->getModule('Db')->_getConfig('populate'); if ($populate) { - $this->phinx(); + $this->phinx($this->getSeedConfig()); } } - private function phinx() { + private function getSeedConfig() { + $seed = $this->_getConfig('seed'); + if($seed === null) { + $seed = true; + } + + return boolval($seed); + } + + private function phinx($seed) { $config = $this->findConfigPath(); $app = new PhinxApplication(); $app->setAutoExit(false); $output = new BufferedOutput(); - + $this->run($app, $output, 'migrate', $config); - $this->run($app, $output, 'seed:run', $config); + + if($seed) { + $this->run($app, $output, 'seed:run', $config); + } } - private function run(PhinxApplication $phinx, BufferedOutput $output, $commandName, $config, $environment='production') { + private function run(PhinxApplication $phinx, BufferedOutput $output, $commandName, $config, $environment = 'production') { $arguments = [ 'command' => $commandName, '--environment' => $environment,