Skip to content

Commit 7019f1e

Browse files
authored
Merge pull request #394 from GeneaLabs/thyseus-caching-key-query-from-instead-model-table
Fixed failing test.
2 parents ba18569 + 8b2b2a0 commit 7019f1e

File tree

5 files changed

+61
-62
lines changed

5 files changed

+61
-62
lines changed

.github/workflows/laravel.yml

+12-12
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/[email protected]
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

+5-5
Original file line numberDiff line numberDiff line change
@@ -15,26 +15,26 @@
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",
4040
"laravel/legacy-factories": "^1.0"

phpunit.xml

+32-42
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

+7-3
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

+5
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)