diff --git a/.gitattributes b/.gitattributes index 1fa4f435..583c8faf 100644 --- a/.gitattributes +++ b/.gitattributes @@ -9,3 +9,4 @@ tests export-ignore .github export-ignore phpstan.neon export-ignore psalm.xml export-ignore +.phive export-ignore diff --git a/.github/codecov.yml b/.github/codecov.yml new file mode 100644 index 00000000..0d79235e --- /dev/null +++ b/.github/codecov.yml @@ -0,0 +1,7 @@ +codecov: + require_ci_to_pass: yes + +coverage: + range: "90...100" + +comment: false diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 40117ba5..0cd59f59 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,34 +13,10 @@ permissions: jobs: testsuite: - uses: cakephp/.github/.github/workflows/testsuite-with-db.yml@5.x - secrets: inherit + uses: ADmad/.github/.github/workflows/testsuite-without-db.yml@master + secrets: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} cs-stan: - name: Coding Standard & Static Analysis - runs-on: ubuntu-22.04 - - steps: - - uses: actions/checkout@v4 - - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: '8.1' - extensions: mbstring, intl - coverage: none - tools: cs2pr, vimeo/psalm:5, phpstan:1.10 - - - name: Composer Install - run: composer install - - - name: Run phpcs - run: vendor/bin/phpcs --report=checkstyle src/ tests/ | cs2pr - - - name: Run psalm - if: always() - run: psalm --output-format=github - - - name: Run phpstan - if: always() - run: phpstan analyse + uses: cakephp/.github/.github/workflows/cs-stan.yml@5.x + secrets: inherit diff --git a/.phive/phars.xml b/.phive/phars.xml new file mode 100644 index 00000000..d311bfa5 --- /dev/null +++ b/.phive/phars.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/phpstan.neon b/phpstan.neon index 05039f8c..e6aa6bea 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,7 +1,9 @@ parameters: level: 8 - checkMissingIterableValueType: false bootstrapFiles: - tests/bootstrap.php paths: - src/ + ignoreErrors: + - + identifier: missingType.iterableValue diff --git a/src/Command/InstallCommand.php b/src/Command/InstallCommand.php index c07f2471..e8c5a5ad 100644 --- a/src/Command/InstallCommand.php +++ b/src/Command/InstallCommand.php @@ -59,7 +59,7 @@ public function installPackages(Arguments $args, ConsoleIo $io): void $output = []; $return = 0; $this->_runNPMInstall($output, $return, $io, $args->getOption('latest') === true); - $io->out($output); + $io->out($output); // @phpstan-ignore argument.type if ($return !== 0) { $io->error('Package installation failed.'); diff --git a/src/View/Helper/OptionsAwareTrait.php b/src/View/Helper/OptionsAwareTrait.php index 8aa771e2..941e8bc0 100644 --- a/src/View/Helper/OptionsAwareTrait.php +++ b/src/View/Helper/OptionsAwareTrait.php @@ -119,9 +119,7 @@ public function removeClasses(array|string $classes, array $options): array foreach ($classes as $class) { $indices = array_keys($options['class'], $class); foreach ($indices as $index) { - if ($index !== false) { - unset($options['class'][$index]); - } + unset($options['class'][$index]); } } diff --git a/tests/TestCase/Bake/BakeTest.php b/tests/TestCase/Bake/BakeTest.php index 27d8803e..f2f9520f 100644 --- a/tests/TestCase/Bake/BakeTest.php +++ b/tests/TestCase/Bake/BakeTest.php @@ -28,7 +28,6 @@ public function setUp(): void $this->_compareBasePath = Plugin::path('BootstrapUI') . 'tests' . DS . 'comparisons' . DS . 'Template' . DS; $this->loadPlugins([ - 'Bake', 'Cake/TwigView' => [ 'bootstrap' => true, ], diff --git a/tests/TestCase/Command/CopyLayoutsCommandTest.php b/tests/TestCase/Command/CopyLayoutsCommandTest.php index a40e4231..5fcc11c7 100644 --- a/tests/TestCase/Command/CopyLayoutsCommandTest.php +++ b/tests/TestCase/Command/CopyLayoutsCommandTest.php @@ -5,7 +5,6 @@ use BootstrapUI\Command\CopyLayoutsCommand; use Cake\Command\Command; -use Cake\Console\Arguments; use Cake\Console\ConsoleIo; use Cake\Console\Exception\StopException; use Cake\Console\TestSuite\ConsoleIntegrationTestTrait; @@ -118,14 +117,12 @@ public function testFilesCannotBeCopied() ->method('_copyLayouts') ->willReturn(false); - $args = new Arguments([], [], []); - $out = new StubConsoleOutput(); $err = new StubConsoleOutput(); $io = new ConsoleIo($out, $err); try { - $result = $command->execute($args, $io); + $result = $command->run([], $io); } catch (StopException $exception) { $result = $exception->getCode(); } diff --git a/tests/TestCase/Command/ModifyViewCommandTest.php b/tests/TestCase/Command/ModifyViewCommandTest.php index ad76f9b6..d1daac9d 100644 --- a/tests/TestCase/Command/ModifyViewCommandTest.php +++ b/tests/TestCase/Command/ModifyViewCommandTest.php @@ -5,7 +5,6 @@ use BootstrapUI\Command\ModifyViewCommand; use Cake\Command\Command; -use Cake\Console\Arguments; use Cake\Console\ConsoleIo; use Cake\Console\Exception\StopException; use Cake\Console\TestSuite\ConsoleIntegrationTestTrait; @@ -118,14 +117,12 @@ public function testPathIsNotAFile() ->method('_isFile') ->willReturn(false); - $args = new Arguments([], [], []); - $out = new StubConsoleOutput(); $err = new StubConsoleOutput(); $io = new ConsoleIo($out, $err); try { - $result = $command->execute($args, $io); + $result = $command->run([], $io); } catch (StopException $exception) { $result = $exception->getCode(); } @@ -156,14 +153,12 @@ public function testFileCannotBeRead() ->method('_readFile') ->willReturn(false); - $args = new Arguments([], [], []); - $out = new StubConsoleOutput(); $err = new StubConsoleOutput(); $io = new ConsoleIo($out, $err); try { - $result = $command->execute($args, $io); + $result = $command->run([], $io); } catch (StopException $exception) { $result = $exception->getCode(); } @@ -194,14 +189,12 @@ public function testFileCannotBeWritten() ->method('_writeFile') ->willReturn(false); - $args = new Arguments([], [], []); - $out = new StubConsoleOutput(); $err = new StubConsoleOutput(); $io = new ConsoleIo($out, $err); try { - $result = $command->execute($args, $io); + $result = $command->run([], $io); } catch (StopException $exception) { $result = $exception->getCode(); }