diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..3e2a926 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,46 @@ +name: Tests +on: [push] +jobs: + run-tests: + runs-on: ubuntu-latest + name: PHP ${{ matrix.php }} - Laravel ${{ matrix.laravel }} + strategy: + fail-fast: true + matrix: + php: [ 7.4, 8.0, 8.1 ] + laravel: [ 6.*, 8.*, 9.* ] + exclude: + - php: 8.0 + laravel: 6.* + - php: 8.1 + laravel: 6.* + - php: 7.4 + laravel: 9.* + include: + - aravel: 6.* + testbench: 4.* + phpunit: 8.* + - laravel: 8.* + testbench: 6.* + phpunit: 9.* + - laravel: 9.* + testbench: 7.* + phpunit: 9.* + steps: + - name: Check out repository code + uses: actions/checkout@v2 + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + - name: Install dependencies + run: | + composer require "illuminate/support:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" "phpunit/phpunit:${{ matrix.phpunit }}" --no-interaction --no-update + composer update --prefer-stable --prefer-dist --no-interaction --no-suggest + - name: Cache dependencies + uses: actions/cache@v1 + with: + path: ~/.composer/cache/files + key: dependencies-${{ matrix.dependency-version }}-laravel-${{ matrix.laravel }}-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }} + - name: Execute tests + run: vendor/bin/phpunit diff --git a/composer.json b/composer.json index 9559d84..f380f01 100644 --- a/composer.json +++ b/composer.json @@ -18,7 +18,7 @@ "illuminate/support": ">=5.5.0" }, "require-dev": { - "phpunit/phpunit": "^8", + "phpunit/phpunit": "9.*", "mockery/mockery": "^1.2", "orchestra/testbench": "^4", "sempro/phpunit-pretty-print": "^1.0" diff --git a/phpunit.xml b/phpunit.xml index 0ed6b64..8523d6c 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -13,10 +13,6 @@ ./tests/Unit - - - ./tests/Feature - diff --git a/tests/Unit/ViewTest.php b/tests/Unit/ViewTest.php index ac6ab63..2419c58 100644 --- a/tests/Unit/ViewTest.php +++ b/tests/Unit/ViewTest.php @@ -75,7 +75,7 @@ public function testRenderWithoutThrowing() $rendered = $this->app['view']->make('exception')->render(); - $this->assertStringStartsWith('[exception] ErrorException Undefined variable: someUnknownVar', (string) $rendered); + $this->assertStringStartsWith('[exception] ErrorException Undefined variable', (string) $rendered); } public function testRenderWithoutThrowingInView() @@ -86,7 +86,7 @@ public function testRenderWithoutThrowingInView() $rendered = $this->app['view']->make('exception')->render(); - $this->assertStringStartsWith('[exception] ErrorException Undefined variable: notExisting ', (string) $rendered); + $this->assertStringContainsString('Undefined variable', (string) $rendered); } public function testRenderWithThrowing() @@ -95,7 +95,7 @@ public function testRenderWithThrowing() $this->addViewsPath(); $this->manager->add('exception', ExceptionShortcode::class); - $this->expectExceptionMessage('Undefined variable: someUnknownVar'); + $this->expectExceptionMessage('Undefined variable'); $rendered = $this->app['view']->make('exception')->render(); } @@ -106,7 +106,7 @@ public function testRenderWithThrowingInView() $this->addViewsPath(); $this->manager->add('exception', ExceptionViewShortcode::class); - $this->expectExceptionMessage('Undefined variable: notExisting'); + $this->expectExceptionMessage('Undefined variable'); $rendered = $this->app['view']->make('exception')->render(); }