Skip to content

Commit

Permalink
Upgrade and github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
vedmant committed Jan 14, 2023
1 parent d4e6129 commit 0a36802
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 9 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 0 additions & 4 deletions phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@
<testsuite name="Unit">
<directory suffix="Test.php">./tests/Unit</directory>
</testsuite>

<testsuite name="Feature">
<directory suffix="Test.php">./tests/Feature</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
Expand Down
8 changes: 4 additions & 4 deletions tests/Unit/ViewTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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()
Expand All @@ -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();
}
Expand All @@ -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();
}
Expand Down

0 comments on commit 0a36802

Please sign in to comment.