From e1a3b1f7c9b3e1626515be398587a9ce29165fb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20=C5=A0tancl?= Date: Wed, 13 May 2020 06:32:07 +0200 Subject: [PATCH] Laravel 6 support for testing --- tests/TestCase.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/TestCase.php b/tests/TestCase.php index 6d245e4c..9388afda 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -6,7 +6,6 @@ namespace Stancl\Tenancy\Tests; use Illuminate\Support\Facades\Redis; use Illuminate\Testing\Assert as PHPUnit; -use Illuminate\Testing\TestResponse; use Stancl\Tenancy\Tests\Etc\Tenant; abstract class TestCase extends \Orchestra\Testbench\TestCase @@ -30,7 +29,9 @@ abstract class TestCase extends \Orchestra\Testbench\TestCase '--realpath' => true, ]); - TestResponse::macro('assertContent', function ($content) { + // Laravel 6.x support + $testResponse = class_exists('Illuminate\Testing\TestResponse') ? 'Illuminate\Testing\TestResponse' : 'Illuminate\Foundation\Testing\TestResponse'; + $testResponse::macro('assertContent', function ($content) { /** @var TestResponse $this */ PHPUnit::assertSame($content, $this->baseResponse->getContent());