Skip to content

Commit

Permalink
ADD laravel 9 support
Browse files Browse the repository at this point in the history
  • Loading branch information
enricodelazzari committed Feb 16, 2022
1 parent f6dd22a commit 405ac15
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 31 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/psalm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
php-version: '8.0'
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick
coverage: none

Expand Down
14 changes: 9 additions & 5 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
name: run-tests

on: [push, pull_request]
on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
test:
Expand All @@ -9,12 +13,12 @@ jobs:
fail-fast: true
matrix:
os: [ubuntu-latest, windows-latest]
php: [8.0, 7.4]
laravel: [8.*]
php: [8.1, 8.0]
laravel: [9.*]
stability: [prefer-lowest, prefer-stable]
include:
- laravel: 8.*
testbench: 6.*
- laravel: 9.*
testbench: 7.*

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

Expand Down
2 changes: 1 addition & 1 deletion .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

return (new PhpCsFixer\Config())
->setRules([
'@PSR2' => true,
'@PSR12' => true,
'array_syntax' => ['syntax' => 'short'],
'ordered_imports' => ['sort_algorithm' => 'alpha'],
'no_unused_imports' => true,
Expand Down
22 changes: 11 additions & 11 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,20 @@
}
],
"require": {
"php": "^7.4|^8.0",
"php": "^8.0",
"ext-json": "*",
"illuminate/database": "^8.0",
"illuminate/http": "^8.0",
"illuminate/routing": "^8.0",
"illuminate/support": "^8.0",
"spatie/laravel-package-tools": "^1.4.3"
"illuminate/database": "^9.0",
"illuminate/http": "^9.0",
"illuminate/routing": "^9.0",
"illuminate/support": "^9.0",
"spatie/laravel-package-tools": "^1.9.2"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^2.18",
"orchestra/testbench": "^6.0",
"phpunit/phpunit": "^9.3",
"spatie/laravel-ray": "^1.9",
"vimeo/psalm": "^4.4"
"friendsofphp/php-cs-fixer": "^3.4",
"orchestra/testbench": "^7.0",
"phpunit/phpunit": "^9.5",
"spatie/laravel-ray": "^1.26",
"vimeo/psalm": "^4.20"
},
"autoload": {
"psr-4": {
Expand Down
4 changes: 2 additions & 2 deletions src/LegalDocumentFinder.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ protected function getLegalDocumentModel(): LegalDocument
{
$legalDocumentModelClass = (string) config('legal-consent.legal_document_model');

return new $legalDocumentModelClass;
return new $legalDocumentModelClass();
}

protected function validateType(string $type): void
{
if (! in_array($type, config('legal-consent.allowed_document_types'))) {
throw new InvalidDocumentTypeException;
throw new InvalidDocumentTypeException();
}
}
}
18 changes: 9 additions & 9 deletions tests/AcceptLegalDocumentListenerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ public function can_auto_accept_documents_after_registration()

$event = new Registered($user);

$listener = new AcceptLegalDocumentListener;
$listener = new AcceptLegalDocumentListener();

$listener->handle($event);

$table = (new LegalConsent)->getTable();
$table = (new LegalConsent())->getTable();

$this->assertDatabaseCount($table, 2);
}
Expand Down Expand Up @@ -71,11 +71,11 @@ public function can_auto_accept_document_after_registration()

$event = new Registered($user);

$listener = new AcceptLegalDocumentListener;
$listener = new AcceptLegalDocumentListener();

$listener->handle($event);

$table = (new LegalConsent)->getTable();
$table = (new LegalConsent())->getTable();

$this->assertDatabaseCount($table, 1);
}
Expand All @@ -100,26 +100,26 @@ public function can_not_auto_accept_document_after_registration_if_request_is_em

$event = new Registered($user);

$listener = new AcceptLegalDocumentListener;
$listener = new AcceptLegalDocumentListener();

$listener->handle($event);

$table = (new LegalConsent)->getTable();
$table = (new LegalConsent())->getTable();

$this->assertDatabaseCount($table, 0);
}

/** @test */
public function ignore_event_if_not_have_user_setted()
{
$event = new class() {
$event = new class () {
};

$listener = new AcceptLegalDocumentListener;
$listener = new AcceptLegalDocumentListener();

$listener->handle($event);

$table = (new LegalConsent)->getTable();
$table = (new LegalConsent())->getTable();

$this->assertDatabaseCount($table, 0);
}
Expand Down
4 changes: 2 additions & 2 deletions tests/LegalConsentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function can_accept_document()
$doc->getKey()
);

$table = (new LegalConsent)->getTable();
$table = (new LegalConsent())->getTable();

$this
->actingAs($user, 'api')
Expand All @@ -52,7 +52,7 @@ public function can_not_accept_document_if_user_is_not_authenticated()
$doc->getKey()
);

$table = (new LegalConsent)->getTable();
$table = (new LegalConsent())->getTable();

$this
->postJson($route)
Expand Down

0 comments on commit 405ac15

Please sign in to comment.