Skip to content

Fixed failing test. #394

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions .github/workflows/laravel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ jobs:
laravel-tests:

runs-on: ubuntu-latest

strategy:
fail-fast: true
matrix:
php: [7.3, 7.4]
php: [7.3, 7.4, 8.0]

name: PHP ${{ matrix.php }}

steps:
- uses: actions/checkout@v2

- name: Cache dependencies
uses: actions/cache@v1
with:
Expand All @@ -33,31 +33,31 @@ jobs:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, gd, pgsql, pdo_pgsql
coverage: none

- uses: zhulik/redis-action@1.1.0
with:
redis version: '5'
number of databases: 100

- uses: harmon758/postgresql-action@v1
with:
postgresql version: '11'
postgresql db: 'testing'
postgresql user: 'homestead'
postgresql password: 'secret'
postgresql password: 'secret'

- name: Remove Nova on a pull request
if: github.event_name == 'pull_request'
run: composer remove laravel/nova --no-update --no-interaction --dev

- name: Copy .env
run: php -r "file_exists('.env') || copy('.env.example', '.env');"

- name: Install Dependencies
run: |
composer config "http-basic.nova.laravel.com" "${{ secrets.NOVA_USERNAME }}" "${{ secrets.NOVA_PASSWORD }}"
composer install -q --no-ansi --no-interaction --no-scripts --no-suggest --no-progress --prefer-dist

- name: Execute Integration and Feature tests via PHPUnit
run: vendor/bin/phpunit --configuration phpunit.xml.dist --testsuite Integration,Feature

Expand Down
10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,26 @@
}
],
"require": {
"php": ">=7.3",
"php": "^7.3|^8.0",
"genealabs/laravel-pivot-events": "^8.0",
"illuminate/cache": "^8.0",
"illuminate/config": "^8.0",
"illuminate/console": "^8.0",
"illuminate/container": "^8.0",
"illuminate/database": "^8.0",
"illuminate/http": "^8.0",
"illuminate/support": "^8.0"
"illuminate/support": "^8.0",
"slevomat/coding-standard": "^6.4"
},
"require-dev": {
"doctrine/dbal": "^2.10",
"fzaninotto/faker": "^1.9",
"fakerphp/faker": "^1.11",
"laravel/nova": "^3.9",
"orchestra/testbench-browser-kit": "^6.0",
"orchestra/testbench": "^6.0",
"php-coveralls/php-coveralls" : "^2.2",
"phpmd/phpmd": "^2.7",
"phpunit/phpunit": "^8.0",
"sebastian/phpcpd": "^5.0",
"phpunit/phpunit": "^9.0",
"squizlabs/php_codesniffer": "^3.4",
"symfony/thanks": "^1.2",
"laravel/legacy-factories": "^1.0"
Expand Down
74 changes: 32 additions & 42 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,44 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
backupGlobals="false"
backupStaticAttributes="false"
bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="true"
>
<testsuites>
<testsuite name="Feature">
<directory suffix="Test.php">./tests/Feature</directory>
</testsuite>
<testsuite name="Integration">
<directory suffix="Test.php">./tests/Integration</directory>
</testsuite>
<testsuite name="Nova">
<directory suffix="Test.php">./tests/Nova</directory>
</testsuite>
</testsuites>
<filter>
<whitelist processUncoveredFilesFromWhitelist="false">
<directory suffix=".php">./src</directory>
</whitelist>
</filter>
<php>
<env name="APP_KEY" value="base64:Xgs1LQt1GdVHhD6qyYCXnyq61DE3UKqJ5k2SJc+Nw2g="/>
<env name="APP_ENV" value="testing"/>
<env name="APP_URL" value="http://localhost"/>
<env name="CACHE_DRIVER" value="redis"/>
<env name="SESSION_DRIVER" value="array"/>
<env name="QUEUE_DRIVER" value="sync"/>
<env name="DB_CONNECTION" value="sqlite"/>
<env name="DB_DATABASE" value=":memory:"/>
<env name="REDIS_HOST" value="127.0.0.1"/>
<env name="PGSQL_HOST" value="127.0.0.1"/>
<env name="PGSQL_USERNAME" value="forge"/>
<env name="PGSQL_PASSWORD" value="EgHVxwTqHq9zikfzAoe6"/>
<env name="PGSQL_DATABASE" value="testing"/>
</php>
<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">
<coverage processUncoveredFiles="false">
<include>
<directory suffix=".php">./src</directory>
</include>
</coverage>
<testsuites>
<testsuite name="Feature">
<directory suffix="Test.php">./tests/Feature</directory>
</testsuite>
<testsuite name="Integration">
<directory suffix="Test.php">./tests/Integration</directory>
</testsuite>
<testsuite name="Nova">
<directory suffix="Test.php">./tests/Nova</directory>
</testsuite>
</testsuites>
<php>
<env name="APP_KEY" value="base64:Xgs1LQt1GdVHhD6qyYCXnyq61DE3UKqJ5k2SJc+Nw2g="/>
<env name="APP_ENV" value="testing"/>
<env name="APP_URL" value="http://localhost"/>
<env name="CACHE_DRIVER" value="redis"/>
<env name="SESSION_DRIVER" value="array"/>
<env name="QUEUE_DRIVER" value="sync"/>
<env name="DB_CONNECTION" value="sqlite"/>
<env name="DB_DATABASE" value=":memory:"/>
<env name="REDIS_HOST" value="127.0.0.1"/>
<env name="PGSQL_HOST" value="127.0.0.1"/>
<env name="PGSQL_USERNAME" value="forge"/>
<env name="PGSQL_PASSWORD" value="EgHVxwTqHq9zikfzAoe6"/>
<env name="PGSQL_DATABASE" value="testing"/>
</php>
</phpunit>
10 changes: 7 additions & 3 deletions tests/Integration/CachedBuilder/BelongsToManyTest.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
<?php namespace GeneaLabs\LaravelModelCaching\Tests\Integration\CachedBuilder;
<?php

declare(strict_types=1);

namespace GeneaLabs\LaravelModelCaching\Tests\Integration\CachedBuilder;

use GeneaLabs\LaravelModelCaching\Tests\Fixtures\Book;
use GeneaLabs\LaravelModelCaching\Tests\Fixtures\BookWithUncachedStore;
Expand All @@ -8,7 +12,7 @@

class BelongsToManyTest extends IntegrationTestCase
{
public function testLazyLoadingRelationship()
public function testLazyLoadingRelationship(): void
{
$bookId = (new Store)
->disableModelCaching()
Expand All @@ -17,7 +21,7 @@ public function testLazyLoadingRelationship()
->books
->first()
->id;
$key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:book-store:genealabslaravelmodelcachingcachedbelongstomany-book_store.book_id_=_{$bookId}");
$key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:stores:genealabslaravelmodelcachingcachedbelongstomany-book_store.book_id_=_{$bookId}");
$tags = [
"genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesstore",
];
Expand Down
5 changes: 5 additions & 0 deletions tools/CodeSniffer.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php
$phpCodeSnifferConfig = array (
'installed_paths' => 'vendor/genealabs/php-coding-standards/src/GeneaLabs,vendor/slevomat/coding-standard/SlevomatCodingStandard',
);
?>