From ef32fc49c09918ed9735ce61b84ef000486d42ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Ara=C3=BAjo=20Paes?= <38794747+ricardoapaes@users.noreply.github.com> Date: Tue, 10 Sep 2024 14:23:49 -0300 Subject: [PATCH 1/3] =?UTF-8?q?=E2=9C=A8=20[EIC-881]=20Adicionando=20confi?= =?UTF-8?q?gura=C3=A7=C3=A3o=20para=20desativar=20seed?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Phinx.php | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/Phinx.php b/src/Phinx.php index 52ff469..08345da 100644 --- a/src/Phinx.php +++ b/src/Phinx.php @@ -13,11 +13,20 @@ 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(); @@ -26,7 +35,10 @@ private function phinx() { $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') { From 567f68fa7bb42b958c28be2f81a0da29cea8c34a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Ara=C3=BAjo=20Paes?= <38794747+ricardoapaes@users.noreply.github.com> Date: Tue, 10 Sep 2024 14:28:31 -0300 Subject: [PATCH 2/3] =?UTF-8?q?=F0=9F=91=B7=20[EIC-881]=20Migrando=20para?= =?UTF-8?q?=20docker=20compose=20v2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 96f5f90..cf15cb5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 From bef5bb3793e303fee355838ac69bc68d13e6d431 Mon Sep 17 00:00:00 2001 From: Ricardo Paes Date: Tue, 10 Sep 2024 14:41:03 -0300 Subject: [PATCH 3/3] =?UTF-8?q?=F0=9F=9A=A8=20[EIC-881]=20Corrigindo=20err?= =?UTF-8?q?os=20`php-cs-fixer`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.example | 2 +- .github/workflows/ci.yml | 4 ++-- .php-cs-fixer.php | 9 +++++---- src/Phinx.php | 4 ++-- 4 files changed, 10 insertions(+), 9 deletions(-) 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 cf15cb5..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: 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 08345da..7d02a54 100644 --- a/src/Phinx.php +++ b/src/Phinx.php @@ -33,7 +33,7 @@ private function phinx($seed) { $app->setAutoExit(false); $output = new BufferedOutput(); - + $this->run($app, $output, 'migrate', $config); if($seed) { @@ -41,7 +41,7 @@ private function phinx($seed) { } } - 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,