Skip to content

Commit f70f51e

Browse files
Only support latest stable Laravel version (#31)
1 parent 163c9df commit f70f51e

File tree

4 files changed

+13
-29
lines changed

4 files changed

+13
-29
lines changed

README.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,6 @@ assertValidationRuleContains($rule, string $class)
7777

7878
Verifies the rule or rules contains an instance of the given [Rule](https://laravel.com/docs/validation#custom-validation-rules) class.
7979

80-
```php
81-
assertNotSoftDeleted(Model $model)
82-
```
83-
84-
Verifies the given model is not _soft deleted_, providing the inverse of [assertSoftDeleted](https://laravel.com/docs/database-testing#available-assertions).
85-
8680
## Matchers
8781
```php
8882
LaravelMatchers::isModel(Model $model = null)
@@ -111,3 +105,8 @@ createFormRequest(string $class, array $data = [])
111105
```
112106

113107
Creates an instance of the given [Form Request](https://laravel.com/docs/7.x/validation#form-request-validation) class with the given request data.
108+
109+
## Support Policy
110+
Starting with version 2, this package will only support the latest stable version of Laravel (currently Laravel 8). If you need to support older versions of Laravel, you may use version 1 or upgrade your application ([try using Shift](https://laravelshift.com)).
111+
112+
This package still follows [semantic versioning](https://semver.org/). However, it does so with respect to its own code. Any breaking changes will increase its major version number. Otherwise, minor version number increases will contain new features. This includes changes for future versions of Laravel.

composer.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@
1010
}
1111
],
1212
"require": {
13-
"php": ">=7.2",
14-
"mockery/mockery": "^1.0",
15-
"phpunit/phpunit": "^7.5|^8.0|^9.0"
13+
"php": ">=7.3",
14+
"illuminate/testing": "^8.0",
15+
"mockery/mockery": "^1.4.2",
16+
"phpunit/phpunit": "^9.3.3"
1617
},
1718
"autoload": {
1819
"psr-4": {

src/AdditionalAssertionsServiceProvider.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,8 @@ class AdditionalAssertionsServiceProvider extends ServiceProvider
99
{
1010
public function register()
1111
{
12-
$test_response_class = class_exists(\Illuminate\Testing\TestResponse::class)
13-
? \Illuminate\Testing\TestResponse::class
14-
: \Illuminate\Foundation\Testing\TestResponse::class;
15-
16-
if (!$test_response_class::hasMacro('assertJsonTypedStructure')) {
17-
$test_response_class::macro('assertJsonTypedStructure', function (array $structure) {
12+
if (!\Illuminate\Testing\TestResponse::hasMacro('assertJsonTypedStructure')) {
13+
\Illuminate\Testing\TestResponse::macro('assertJsonTypedStructure', function (array $structure) {
1814
AdditionalAssertions::assertArrayStructure($structure, $this->json());
1915

2016
return $this;

src/Traits/AdditionalAssertions.php

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
namespace JMac\Testing\Traits;
44

5-
use Illuminate\Support\Facades\Route;
65
use Illuminate\Database\Eloquent\Model;
6+
use Illuminate\Support\Facades\Route;
77
use PHPUnit\Framework\Assert as PHPUnitAssert;
88
use Symfony\Component\HttpFoundation\Request as SymfonyRequest;
99

@@ -113,11 +113,7 @@ public function createFormRequest(string $form_request, array $data = [])
113113

114114
public function assertValidationRules(array $expected, array $actual)
115115
{
116-
if (class_exists(\Illuminate\Testing\Assert::class)) {
117-
\Illuminate\Testing\Assert::assertArraySubset($this->normalizeRules($expected), $this->normalizeRules($actual));
118-
} else {
119-
\Illuminate\Foundation\Testing\Assert::assertArraySubset($this->normalizeRules($expected), $this->normalizeRules($actual));
120-
}
116+
\Illuminate\Testing\Assert::assertArraySubset($this->normalizeRules($expected), $this->normalizeRules($actual));
121117
}
122118

123119
public function assertExactValidationRules(array $expected, array $actual)
@@ -179,14 +175,6 @@ public static function assertArrayStructure(array $structure, array $actual)
179175
}
180176
}
181177

182-
public function assertNotSoftDeleted(Model $model)
183-
{
184-
return $this->assertDatabaseHas($model->getTable(), [
185-
$model->getKeyName() => $model->getKey(),
186-
'deleted_at' => null,
187-
]);
188-
}
189-
190178
private function normalizeRules(array $rules)
191179
{
192180
return array_map([$this, 'expandRules'], $rules);

0 commit comments

Comments
 (0)