Skip to content

Commit

Permalink
⬆️ Laravel 11 Support, update text matrix, update PHPUnit, Update GA …
Browse files Browse the repository at this point in the history
…Action (#8)

⬆️ Laravel 11 Support, update text matrix, update PHPUnit, Update GA Action
  • Loading branch information
robertmarney authored Sep 4, 2024
2 parents 1447988 + 1504390 commit a9ba5cb
Show file tree
Hide file tree
Showing 10 changed files with 48 additions and 29 deletions.
4 changes: 4 additions & 0 deletions .docker/php.development.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,7 @@ RUN apt-get update \
php8.3-xdebug \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/*

RUN addgroup --gid 1000 composer && \
adduser --disabled-password --ingroup composer --uid 1000 composer

35 changes: 29 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,35 +15,58 @@ jobs:
runs-on: ubuntu-latest

strategy:
fail-fast: true
matrix:
php: ['8.0', '8.1', '8.2']
laravel: [ '8.*', '9.*', '10.*', '11.*' ]
dependency-version: [ prefer-stable ]
include:
- laravel: 10.*
testbench: 8.*
- laravel: 9.*
testbench: 7.*
- laravel: 8.*
testbench: 6.*
- laravel: 11.*
testbench: 9.*
exclude:
- laravel: 10.*
php: 8.0
- laravel: 11.*
php: 8.1
- laravel: 11.*
php: 8.0

name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }} - ${{ matrix.os }}

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
- name: Copy .env.testing
run: php -r "file_exists('.env.testing') || copy('.env.testing.example', '.env.testing');"
- name: Set Nova credentials
run: echo '${{ secrets.NOVA_4_CREDENTIALS }}' > auth.json
run: composer config http-basic.nova.laravel.com ${{ secrets.NOVA_4_EMAIL }} ${{ secrets.NOVA_4_CREDENTIALS }}
- name: Install Dependencies
run: composer update --no-interaction --prefer-source
run: |
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction
- name: Execute tests (Unit and Feature tests) via PHPUnit
run: ./vendor/bin/phpunit
lint:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: shivammathur/setup-php@v2
with:
php-version: "8.1"
- name: Copy .env.testing
run: php -r "file_exists('.env.testing') || copy('.env.testing.example', '.env.testing');"
- name: Set Nova credentials
run: echo '${{ secrets.NOVA_4_CREDENTIALS }}' > auth.json
run: composer config http-basic.nova.laravel.com ${{ secrets.NOVA_4_EMAIL }} ${{ secrets.NOVA_4_CREDENTIALS }}
- name: Install Dependencies
run: composer update --no-interaction --prefer-source
run: composer update --prefer-stable --prefer-dist --no-interaction
- name: Execute tests (Unit and Feature tests) via PHPUnit
run: ./vendor/bin/php-cs-fixer fix --dry-run
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ clover.xml

auth.json

.phpunit.cache
.phpunit.result.cache
.phpunit.result/
.php_cs.cache
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ composer require --dev joshgaber/novaunit
* PHP 7.3 or higher (Latest is 8.0)
* [Laravel](https://laravel.com/) 6.x - 10.x
* [Laravel Nova](https://nova.laravel.com/) 2.x - 4.x
* [PHPUnit](https://github.com/sebastianbergmann/phpunit) 8.5.x - 10.x
* [PHPUnit](https://github.com/sebastianbergmann/phpunit) 8.5.x - 11.x

## Usage

Expand Down
9 changes: 4 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,16 @@
}
],
"require": {
"php": "^8.0",
"php": "^8.0|^8.1|^8.2",
"ext-mbstring": "*",
"cakephp/chronos": ">=2.0.0",
"illuminate/support": "^8.83.4|^9.3.1|^10.0",
"illuminate/support": "^8.83.4|^9.3.1|^10.0|^11.0",
"laravel/nova": "^4.0",
"phpunit/phpunit": "^9.0|^10.0"
"phpunit/phpunit": "^9.0|^10.0|^11.0"
},
"require-dev": {
"php": "^8.2",
"friendsofphp/php-cs-fixer": "^3.0",
"orchestra/testbench": "^6.0|^8.0"
"orchestra/testbench": "^6.0|^8.0|^9.0"
},
"repositories": [
{
Expand Down
1 change: 0 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ services:
context: .docker
dockerfile: php.development.dockerfile
restart: unless-stopped
user: 1000:1000
working_dir: /srv
volumes:
- .:/srv
Expand Down
20 changes: 7 additions & 13 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,24 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
bootstrap="vendor/autoload.php"
backupGlobals="false"
colors="true"
processIsolation="false"
stopOnFailure="false"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.0/phpunit.xsd"
cacheDirectory=".phpunit.cache"
backupStaticProperties="false">
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="vendor/autoload.php" backupGlobals="false" colors="true" processIsolation="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd" cacheDirectory=".phpunit.cache" backupStaticProperties="false">
<testsuites>
<testsuite name="Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
<coverage>
<include>
<directory suffix=".php">src</directory>
</include>
<report>
<clover outputFile="clover.xml" />
<clover outputFile="clover.xml"/>
</report>
</coverage>
<source>
<include>
<directory suffix=".php">src</directory>
</include>
</source>
</phpunit>
2 changes: 1 addition & 1 deletion src/Constraints/IsActionResponseType.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function toString(): string

public function matches($response): bool
{
if (is_array($this->actionResponse)){
if (is_array($this->actionResponse)) {
$structure = \array_keys(\call_user_func([Action::class, $this->actionType], 'param 1', 'param 2'));
$responseKeys = \array_keys($response);

Expand Down
2 changes: 1 addition & 1 deletion src/Filters/MockFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function assertSelectFilter(string $message = ''): self
PHPUnit::assertThat(
$this->component,
PHPUnit::logicalAnd(
new isInstanceOf(Filter::class),
new IsInstanceOf(Filter::class),
PHPUnit::logicalNot(new IsInstanceOf(BooleanFilter::class)),
PHPUnit::logicalNot(new IsInstanceOf(DateFilter::class))
),
Expand Down
1 change: 0 additions & 1 deletion tests/Feature/Actions/MockActionResponseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ public function testItFailsOnResponseOtherThanRedirect()
$mockActionResponse->assertRedirect();
}


public function testItFailsOnResponseOtherThanPush()
{
$this->shouldFail();
Expand Down

0 comments on commit a9ba5cb

Please sign in to comment.