Performed fixes for failing tests on php8

- Commands that run a truncate DB action failed due to messing up the
  test transations so we mnaully work around that now to ensure a
transaction exists for the test to cleanup afterwards.
- Updated dompdf lib version
This commit is contained in:
Dan Brown 2021-03-20 16:25:02 +00:00
parent 0310b8614e
commit 8e5067ee91
5 changed files with 29 additions and 19 deletions

View File

@ -12,7 +12,7 @@
"ext-json": "*", "ext-json": "*",
"ext-mbstring": "*", "ext-mbstring": "*",
"ext-xml": "*", "ext-xml": "*",
"barryvdh/laravel-dompdf": "^0.8.7", "barryvdh/laravel-dompdf": "^0.9.0",
"barryvdh/laravel-snappy": "^0.4.8", "barryvdh/laravel-snappy": "^0.4.8",
"doctrine/dbal": "^2.12.1", "doctrine/dbal": "^2.12.1",
"facade/ignition": "^1.16.4", "facade/ignition": "^1.16.4",

36
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "5b6d8f6e2d5594a7b0b5016c5fe284da", "content-hash": "b26d29958d84c91b164a8234d1a7e9e9",
"packages": [ "packages": [
{ {
"name": "aws/aws-sdk-php", "name": "aws/aws-sdk-php",
@ -98,27 +98,27 @@
}, },
{ {
"name": "barryvdh/laravel-dompdf", "name": "barryvdh/laravel-dompdf",
"version": "v0.8.7", "version": "v0.9.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/barryvdh/laravel-dompdf.git", "url": "https://github.com/barryvdh/laravel-dompdf.git",
"reference": "30310e0a675462bf2aa9d448c8dcbf57fbcc517d" "reference": "5b99e1f94157d74e450f4c97e8444fcaffa2144b"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/barryvdh/laravel-dompdf/zipball/30310e0a675462bf2aa9d448c8dcbf57fbcc517d", "url": "https://api.github.com/repos/barryvdh/laravel-dompdf/zipball/5b99e1f94157d74e450f4c97e8444fcaffa2144b",
"reference": "30310e0a675462bf2aa9d448c8dcbf57fbcc517d", "reference": "5b99e1f94157d74e450f4c97e8444fcaffa2144b",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"dompdf/dompdf": "^0.8", "dompdf/dompdf": "^1",
"illuminate/support": "^5.5|^6|^7|^8", "illuminate/support": "^5.5|^6|^7|^8",
"php": ">=7" "php": "^7.1 || ^8.0"
}, },
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "0.8-dev" "dev-master": "0.9-dev"
}, },
"laravel": { "laravel": {
"providers": [ "providers": [
@ -152,7 +152,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/barryvdh/laravel-dompdf/issues", "issues": "https://github.com/barryvdh/laravel-dompdf/issues",
"source": "https://github.com/barryvdh/laravel-dompdf/tree/master" "source": "https://github.com/barryvdh/laravel-dompdf/tree/v0.9.0"
}, },
"funding": [ "funding": [
{ {
@ -160,7 +160,7 @@
"type": "github" "type": "github"
} }
], ],
"time": "2020-09-07T11:50:18+00:00" "time": "2020-12-27T12:05:53+00:00"
}, },
{ {
"name": "barryvdh/laravel-snappy", "name": "barryvdh/laravel-snappy",
@ -709,16 +709,16 @@
}, },
{ {
"name": "dompdf/dompdf", "name": "dompdf/dompdf",
"version": "v0.8.6", "version": "v1.0.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/dompdf/dompdf.git", "url": "https://github.com/dompdf/dompdf.git",
"reference": "db91d81866c69a42dad1d2926f61515a1e3f42c5" "reference": "8768448244967a46d6e67b891d30878e0e15d25c"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/dompdf/dompdf/zipball/db91d81866c69a42dad1d2926f61515a1e3f42c5", "url": "https://api.github.com/repos/dompdf/dompdf/zipball/8768448244967a46d6e67b891d30878e0e15d25c",
"reference": "db91d81866c69a42dad1d2926f61515a1e3f42c5", "reference": "8768448244967a46d6e67b891d30878e0e15d25c",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -726,11 +726,11 @@
"ext-mbstring": "*", "ext-mbstring": "*",
"phenx/php-font-lib": "^0.5.2", "phenx/php-font-lib": "^0.5.2",
"phenx/php-svg-lib": "^0.3.3", "phenx/php-svg-lib": "^0.3.3",
"php": "^7.1" "php": "^7.1 || ^8.0"
}, },
"require-dev": { "require-dev": {
"mockery/mockery": "^1.3", "mockery/mockery": "^1.3",
"phpunit/phpunit": "^7.5", "phpunit/phpunit": "^7.5 || ^8 || ^9",
"squizlabs/php_codesniffer": "^3.5" "squizlabs/php_codesniffer": "^3.5"
}, },
"suggest": { "suggest": {
@ -775,9 +775,9 @@
"homepage": "https://github.com/dompdf/dompdf", "homepage": "https://github.com/dompdf/dompdf",
"support": { "support": {
"issues": "https://github.com/dompdf/dompdf/issues", "issues": "https://github.com/dompdf/dompdf/issues",
"source": "https://github.com/dompdf/dompdf/tree/master" "source": "https://github.com/dompdf/dompdf/tree/v1.0.2"
}, },
"time": "2020-08-30T22:54:22+00:00" "time": "2021-01-08T14:18:52+00:00"
}, },
{ {
"name": "dragonmantank/cron-expression", "name": "dragonmantank/cron-expression",

View File

@ -2,6 +2,7 @@
use BookStack\Actions\ActivityType; use BookStack\Actions\ActivityType;
use BookStack\Entities\Models\Page; use BookStack\Entities\Models\Page;
use Illuminate\Support\Facades\DB;
use Tests\TestCase; use Tests\TestCase;
class ClearActivityCommandTest extends TestCase class ClearActivityCommandTest extends TestCase
@ -18,7 +19,10 @@ class ClearActivityCommandTest extends TestCase
'user_id' => $this->getEditor()->id 'user_id' => $this->getEditor()->id
]); ]);
DB::rollBack();
$exitCode = \Artisan::call('bookstack:clear-activity'); $exitCode = \Artisan::call('bookstack:clear-activity');
DB::beginTransaction();
$this->assertTrue($exitCode === 0, 'Command executed successfully'); $this->assertTrue($exitCode === 0, 'Command executed successfully');

View File

@ -1,6 +1,7 @@
<?php namespace Tests\Commands; <?php namespace Tests\Commands;
use BookStack\Entities\Models\Page; use BookStack\Entities\Models\Page;
use Illuminate\Support\Facades\DB;
use Tests\TestCase; use Tests\TestCase;
class ClearViewsCommandTest extends TestCase class ClearViewsCommandTest extends TestCase
@ -19,7 +20,9 @@ class ClearViewsCommandTest extends TestCase
'views' => 1 'views' => 1
]); ]);
DB::rollBack();
$exitCode = \Artisan::call('bookstack:clear-views'); $exitCode = \Artisan::call('bookstack:clear-views');
DB::beginTransaction();
$this->assertTrue($exitCode === 0, 'Command executed successfully'); $this->assertTrue($exitCode === 0, 'Command executed successfully');
$this->assertDatabaseMissing('views', [ $this->assertDatabaseMissing('views', [

View File

@ -2,12 +2,14 @@
use BookStack\Auth\Permissions\JointPermission; use BookStack\Auth\Permissions\JointPermission;
use BookStack\Entities\Models\Page; use BookStack\Entities\Models\Page;
use Illuminate\Support\Facades\DB;
use Tests\TestCase; use Tests\TestCase;
class RegeneratePermissionsCommandTest extends TestCase class RegeneratePermissionsCommandTest extends TestCase
{ {
public function test_regen_permissions_command() public function test_regen_permissions_command()
{ {
\DB::rollBack();
JointPermission::query()->truncate(); JointPermission::query()->truncate();
$page = Page::first(); $page = Page::first();
@ -15,6 +17,7 @@ class RegeneratePermissionsCommandTest extends TestCase
$exitCode = \Artisan::call('bookstack:regenerate-permissions'); $exitCode = \Artisan::call('bookstack:regenerate-permissions');
$this->assertTrue($exitCode === 0, 'Command executed successfully'); $this->assertTrue($exitCode === 0, 'Command executed successfully');
DB::beginTransaction();
$this->assertDatabaseHas('joint_permissions', ['entity_id' => $page->id]); $this->assertDatabaseHas('joint_permissions', ['entity_id' => $page->id]);
} }