Skip to content

Commit 6f2b2af

Browse files
committed
Fixed failing test.
1 parent b5d5a6f commit 6f2b2af

File tree

6 files changed

+122
-69
lines changed

6 files changed

+122
-69
lines changed

.github/workflows/laravel.yml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,17 @@ jobs:
1010
laravel-tests:
1111

1212
runs-on: ubuntu-latest
13-
13+
1414
strategy:
1515
fail-fast: true
1616
matrix:
17-
php: [7.3, 7.4]
18-
17+
php: [7.3, 7.4, 8.0]
18+
1919
name: PHP ${{ matrix.php }}
20-
20+
2121
steps:
2222
- uses: actions/checkout@v2
23-
23+
2424
- name: Cache dependencies
2525
uses: actions/cache@v1
2626
with:
@@ -33,31 +33,31 @@ jobs:
3333
php-version: ${{ matrix.php }}
3434
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, gd, pgsql, pdo_pgsql
3535
coverage: none
36-
36+
3737
- uses: zhulik/redis-action@1.1.0
3838
with:
3939
redis version: '5'
4040
number of databases: 100
41-
41+
4242
- uses: harmon758/postgresql-action@v1
4343
with:
4444
postgresql version: '11'
4545
postgresql db: 'testing'
4646
postgresql user: 'homestead'
47-
postgresql password: 'secret'
48-
47+
postgresql password: 'secret'
48+
4949
- name: Remove Nova on a pull request
5050
if: github.event_name == 'pull_request'
5151
run: composer remove laravel/nova --no-update --no-interaction --dev
52-
52+
5353
- name: Copy .env
5454
run: php -r "file_exists('.env') || copy('.env.example', '.env');"
55-
55+
5656
- name: Install Dependencies
5757
run: |
5858
composer config "http-basic.nova.laravel.com" "${{ secrets.NOVA_USERNAME }}" "${{ secrets.NOVA_PASSWORD }}"
5959
composer install -q --no-ansi --no-interaction --no-scripts --no-suggest --no-progress --prefer-dist
60-
60+
6161
- name: Execute Integration and Feature tests via PHPUnit
6262
run: vendor/bin/phpunit --configuration phpunit.xml.dist --testsuite Integration,Feature
6363

composer.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,29 +15,30 @@
1515
}
1616
],
1717
"require": {
18-
"php": ">=7.3",
18+
"php": "^7.3|^8.0",
1919
"genealabs/laravel-pivot-events": "^8.0",
2020
"illuminate/cache": "^8.0",
2121
"illuminate/config": "^8.0",
2222
"illuminate/console": "^8.0",
2323
"illuminate/container": "^8.0",
2424
"illuminate/database": "^8.0",
2525
"illuminate/http": "^8.0",
26-
"illuminate/support": "^8.0"
26+
"illuminate/support": "^8.0",
27+
"slevomat/coding-standard": "^6.4"
2728
},
2829
"require-dev": {
2930
"doctrine/dbal": "^2.10",
30-
"fzaninotto/faker": "^1.9",
31+
"fakerphp/faker": "^1.11",
3132
"laravel/nova": "^3.9",
3233
"orchestra/testbench-browser-kit": "^6.0",
3334
"orchestra/testbench": "^6.0",
3435
"php-coveralls/php-coveralls" : "^2.2",
3536
"phpmd/phpmd": "^2.7",
36-
"phpunit/phpunit": "^8.0",
37-
"sebastian/phpcpd": "^5.0",
37+
"phpunit/phpunit": "^9.0",
3838
"squizlabs/php_codesniffer": "^3.4",
3939
"symfony/thanks": "^1.2",
40-
"laravel/legacy-factories": "^1.0"
40+
"laravel/legacy-factories": "^1.0",
41+
"genealabs/php-coding-standards": "^0.1.4"
4142
},
4243
"autoload": {
4344
"psr-4": {

phpcs.xml

Lines changed: 59 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,64 @@
11
<?xml version="1.0"?>
2-
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="PHP_CodeSniffer" xsi:noNamespaceSchemaLocation="phpcs.xsd">
2+
<ruleset
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
name="PHP_CodeSniffer"
5+
xsi:noNamespaceSchemaLocation="phpcs.xsd"
6+
>
37
<description>GeneaLabs coding standards.</description>
48

5-
<rule ref="PSR1"></rule>
6-
<rule ref="PSR2"></rule>
7-
<rule ref="PSR12">
8-
<exclude name="PSR12.Classes.ClassInstantiation.MissingParentheses"/>
9-
<exclude name="PSR12.Functions.ReturnTypeDeclaration.SpaceBeforeColon"/>
9+
<file>app</file>
10+
<file>bootstrap</file>
11+
<file>config</file>
12+
<file>database</file>
13+
<file>resources</file>
14+
<file>routes</file>
15+
<file>storage</file>
16+
<file>tests</file>
17+
18+
<exclude-pattern>*/*.css</exclude-pattern>
19+
<exclude-pattern>*/*.js</exclude-pattern>
20+
<exclude-pattern>*/*.xml</exclude-pattern>
21+
<exclude-pattern>*/cache/*</exclude-pattern>
22+
<exclude-pattern>*/docker/*</exclude-pattern>
23+
<exclude-pattern>*/public/*</exclude-pattern>
24+
<exclude-pattern>*/reference/*</exclude-pattern>
25+
<exclude-pattern>*/storage/debugbar/*</exclude-pattern>
26+
<exclude-pattern>*/storage/framework/*</exclude-pattern>
27+
<exclude-pattern>*/storage/logs/*</exclude-pattern>
28+
<exclude-pattern>*/tools/*</exclude-pattern>
29+
<exclude-pattern>*/vendor/*</exclude-pattern>
30+
<exclude-pattern>bootstrap/autoload.php</exclude-pattern>
31+
<exclude-pattern>bootstrap/cache/*</exclude-pattern>
32+
33+
<arg name="tab-width" value="4"/>
34+
<arg value="p"/>
35+
36+
<rule ref="GeneaLabs">
37+
<exclude name="GeneaLabs.TypeHinting.ReturnType.MissingReturnType"/>
38+
<exclude name="GeneaLabs.Whitespace.EmptyLineBeforeReturn.EmptyLineBeforeReturn"/>
39+
<exclude name="GeneaLabs.Whitespace.EmptyLineAroundControlStructure.EmptyLineBeforeControlStructure"/>
40+
</rule>
41+
42+
<rule ref="SlevomatCodingStandard">
43+
<exclude name="SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingTraversableTypeHintSpecification"/>
44+
<exclude name="SlevomatCodingStandard.Files.TypeNameMatchesFileName.NoMatchBetweenTypeNameAndFileName"/>
45+
<exclude name="SlevomatCodingStandard.Classes.EmptyLinesAroundClassBraces.NoEmptyLineAfterOpeningBrace"/>
46+
<exclude name="SlevomatCodingStandard.Namespaces.UseOnlyWhitelistedNamespaces.NonFullyQualified"/>
47+
<exclude name="SlevomatCodingStandard.ControlStructures.RequireSingleLineCondition.RequiredSingleLineCondition"/>
48+
<exclude name="SlevomatCodingStandard.Namespaces.FullyQualifiedGlobalFunctions.NonFullyQualified"/>
49+
<exclude name="SlevomatCodingStandard.Classes.EmptyLinesAroundClassBraces.NoEmptyLineBeforeClosingBrace"/>
50+
<exclude name="SlevomatCodingStandard.TypeHints.DeclareStrictTypes.IncorrectWhitespaceBetweenOpenTagAndDeclare"/>
51+
<exclude name="SlevomatCodingStandard.TypeHints.DeclareStrictTypes.IncorrectStrictTypesFormat"/>
52+
<exclude name="SlevomatCodingStandard.Namespaces.FullyQualifiedExceptions.NonFullyQualifiedException"/>
53+
<exclude name="SlevomatCodingStandard.ControlStructures.NewWithParentheses.MissingParentheses"/>
54+
<exclude name="SlevomatCodingStandard.ControlStructures.RequireYodaComparison.RequiredYodaComparison"/>
55+
<exclude name="SlevomatCodingStandard.Classes.TraitUseSpacing.IncorrectLinesCountBeforeFirstUse"/>
56+
<exclude name="SlevomatCodingStandard.TypeHints.PropertyTypeHint.MissingTraversableTypeHintSpecification"/>
57+
<exclude name="SlevomatCodingStandard.Functions.StaticClosure.ClosureNotStatic"/>
58+
<exclude name="SlevomatCodingStandard.Functions.RequireArrowFunction.RequiredArrowFunction"/>
59+
<exclude name="SlevomatCodingStandard.Namespaces.FullyQualifiedGlobalConstants.NonFullyQualified"/>
60+
<exclude name="SlevomatCodingStandard.Functions.RequireSingleLineCall.RequiredSingleLineCall"/>
61+
<exclude name="SlevomatCodingStandard.Operators.DisallowIncrementAndDecrementOperators.DisallowedPostIncrementOperator"/>
62+
<exclude name="SlevomatCodingStandard.ControlStructures.DisallowShortTernaryOperator.DisallowedShortTernaryOperator)phpcs"/>
1063
</rule>
1164
</ruleset>

phpunit.xml

Lines changed: 32 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,34 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit
3-
backupGlobals="false"
4-
backupStaticAttributes="false"
5-
bootstrap="vendor/autoload.php"
6-
colors="true"
7-
convertErrorsToExceptions="true"
8-
convertNoticesToExceptions="true"
9-
convertWarningsToExceptions="true"
10-
processIsolation="false"
11-
stopOnFailure="true"
12-
>
13-
<testsuites>
14-
<testsuite name="Feature">
15-
<directory suffix="Test.php">./tests/Feature</directory>
16-
</testsuite>
17-
<testsuite name="Integration">
18-
<directory suffix="Test.php">./tests/Integration</directory>
19-
</testsuite>
20-
<testsuite name="Nova">
21-
<directory suffix="Test.php">./tests/Nova</directory>
22-
</testsuite>
23-
</testsuites>
24-
<filter>
25-
<whitelist processUncoveredFilesFromWhitelist="false">
26-
<directory suffix=".php">./src</directory>
27-
</whitelist>
28-
</filter>
29-
<php>
30-
<env name="APP_KEY" value="base64:Xgs1LQt1GdVHhD6qyYCXnyq61DE3UKqJ5k2SJc+Nw2g="/>
31-
<env name="APP_ENV" value="testing"/>
32-
<env name="APP_URL" value="http://localhost"/>
33-
<env name="CACHE_DRIVER" value="redis"/>
34-
<env name="SESSION_DRIVER" value="array"/>
35-
<env name="QUEUE_DRIVER" value="sync"/>
36-
<env name="DB_CONNECTION" value="sqlite"/>
37-
<env name="DB_DATABASE" value=":memory:"/>
38-
<env name="REDIS_HOST" value="127.0.0.1"/>
39-
<env name="PGSQL_HOST" value="127.0.0.1"/>
40-
<env name="PGSQL_USERNAME" value="forge"/>
41-
<env name="PGSQL_PASSWORD" value="EgHVxwTqHq9zikfzAoe6"/>
42-
<env name="PGSQL_DATABASE" value="testing"/>
43-
</php>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" backupStaticAttributes="false" bootstrap="vendor/autoload.php" colors="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="true" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
3+
<coverage processUncoveredFiles="false">
4+
<include>
5+
<directory suffix=".php">./src</directory>
6+
</include>
7+
</coverage>
8+
<testsuites>
9+
<testsuite name="Feature">
10+
<directory suffix="Test.php">./tests/Feature</directory>
11+
</testsuite>
12+
<testsuite name="Integration">
13+
<directory suffix="Test.php">./tests/Integration</directory>
14+
</testsuite>
15+
<testsuite name="Nova">
16+
<directory suffix="Test.php">./tests/Nova</directory>
17+
</testsuite>
18+
</testsuites>
19+
<php>
20+
<env name="APP_KEY" value="base64:Xgs1LQt1GdVHhD6qyYCXnyq61DE3UKqJ5k2SJc+Nw2g="/>
21+
<env name="APP_ENV" value="testing"/>
22+
<env name="APP_URL" value="http://localhost"/>
23+
<env name="CACHE_DRIVER" value="redis"/>
24+
<env name="SESSION_DRIVER" value="array"/>
25+
<env name="QUEUE_DRIVER" value="sync"/>
26+
<env name="DB_CONNECTION" value="sqlite"/>
27+
<env name="DB_DATABASE" value=":memory:"/>
28+
<env name="REDIS_HOST" value="127.0.0.1"/>
29+
<env name="PGSQL_HOST" value="127.0.0.1"/>
30+
<env name="PGSQL_USERNAME" value="forge"/>
31+
<env name="PGSQL_PASSWORD" value="EgHVxwTqHq9zikfzAoe6"/>
32+
<env name="PGSQL_DATABASE" value="testing"/>
33+
</php>
4434
</phpunit>

tests/Integration/CachedBuilder/BelongsToManyTest.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
<?php namespace GeneaLabs\LaravelModelCaching\Tests\Integration\CachedBuilder;
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace GeneaLabs\LaravelModelCaching\Tests\Integration\CachedBuilder;
26

37
use GeneaLabs\LaravelModelCaching\Tests\Fixtures\Book;
48
use GeneaLabs\LaravelModelCaching\Tests\Fixtures\BookWithUncachedStore;
@@ -8,7 +12,7 @@
812

913
class BelongsToManyTest extends IntegrationTestCase
1014
{
11-
public function testLazyLoadingRelationship()
15+
public function testLazyLoadingRelationship(): void
1216
{
1317
$bookId = (new Store)
1418
->disableModelCaching()
@@ -17,7 +21,7 @@ public function testLazyLoadingRelationship()
1721
->books
1822
->first()
1923
->id;
20-
$key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:book-store:genealabslaravelmodelcachingcachedbelongstomany-book_store.book_id_=_{$bookId}");
24+
$key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:stores:genealabslaravelmodelcachingcachedbelongstomany-book_store.book_id_=_{$bookId}");
2125
$tags = [
2226
"genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesstore",
2327
];

tools/CodeSniffer.conf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?php
2+
$phpCodeSnifferConfig = array (
3+
'installed_paths' => 'vendor/genealabs/php-coding-standards/src/GeneaLabs,vendor/slevomat/coding-standard/SlevomatCodingStandard',
4+
);
5+
?>

0 commit comments

Comments
 (0)