Skip to content

Commit f026fc7

Browse files
committed
refactor(testing)!: Removed deprecated \LastDragon_ru\LaraASP\Testing\Assertions\ResponseAssertions::assertThatResponse(), \LastDragon_ru\LaraASP\Testing\Database\RefreshDatabaseIfEmpty, \LastDragon_ru\LaraASP\Testing\TestCase.
1 parent 710ce90 commit f026fc7

10 files changed

+5
-377
lines changed

composer-dependency-analyser.php

-6
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
<?php declare(strict_types = 1);
22

3-
use Illuminate\Foundation\Testing\RefreshDatabase;
4-
use Illuminate\Foundation\Testing\RefreshDatabaseState;
5-
use Illuminate\Foundation\Testing\TestCase;
63
use Orchestra\Testbench\TestCase as TestbenchTestCase;
74
use ShipMonk\ComposerDependencyAnalyser\Config\Configuration;
85
use ShipMonk\ComposerDependencyAnalyser\Config\ErrorType;
@@ -16,9 +13,6 @@
1613
->ignoreErrorsOnPackage('bamarni/composer-bin-plugin', [ErrorType::UNUSED_DEPENDENCY])
1714
->ignoreErrorsOnPackage('laravel/scout', [ErrorType::DEV_DEPENDENCY_IN_PROD])
1815
->ignoreUnknownClasses([
19-
RefreshDatabase::class,
20-
RefreshDatabaseState::class,
21-
TestCase::class,
2216
TestbenchTestCase::class,
2317
]);
2418

packages/testing/README.md

+3-39
Original file line numberDiff line numberDiff line change
@@ -135,36 +135,6 @@ Makes comparison of scalars strict.
135135

136136
## PHPUnit `TestCase`
137137

138-
### [`RefreshDatabaseIfEmpty`](./src/Database/RefreshDatabaseIfEmpty.php) 💀
139-
140-
[include:docblock]: ./src/Database/RefreshDatabaseIfEmpty.php
141-
[//]: # (start: preprocess/94562f6acfa81b98)
142-
[//]: # (warning: Generated automatically. Do not edit.)
143-
144-
The trait is very similar to standard `\Illuminate\Foundation\Testing\RefreshDatabase` but there is one
145-
difference: it will refresh the database only if it is empty. This is very
146-
useful for local testing and allow significantly reduce bootstrap time.
147-
148-
[//]: # (end: preprocess/94562f6acfa81b98)
149-
150-
```php
151-
<?php declare(strict_types = 1);
152-
153-
namespace Tests;
154-
155-
use LastDragon_ru\LaraASP\Testing\Database\RefreshDatabaseIfEmpty;
156-
use LastDragon_ru\LaraASP\Testing\TestCase as BaseTestCase;
157-
158-
abstract class TestCase extends BaseTestCase {
159-
use CreatesApplication;
160-
use RefreshDatabaseIfEmpty;
161-
162-
protected function shouldSeed() {
163-
return true;
164-
}
165-
}
166-
```
167-
168138
### [`WithTempDirectory`](./src/Utils/WithTempDirectory.php)
169139

170140
[include:docblock]: ./src/Utils/WithTempDirectory.php
@@ -250,9 +220,9 @@ Disable models events during make/create.
250220

251221
| Name | Description |
252222
|-----------------------------------------------------------------------------|----------------------------------------------------------------|
253-
| [`assertThat()`](./docs/Assertions/AssertThatResponse.md) | Asserts that response satisfies given constraint. |
254-
| [`assertContentType()`](./docs/Assertions/AssertThatResponse.md) | Asserts that a response has a specified content type. |
255-
| [`assertStatusCode()`](./docs/Assertions/AssertThatResponse.md) | Asserts that a response has a specified status code. |
223+
| [`assertThat()`](./docs/Assertions/AssertPsrResponse.md) | Asserts that response satisfies given constraint. |
224+
| [`assertContentType()`](./docs/Assertions/AssertPsrResponse.md) | Asserts that a response has a specified content type. |
225+
| [`assertStatusCode()`](./docs/Assertions/AssertPsrResponse.md) | Asserts that a response has a specified status code. |
256226
| [`assertJsonMatchesSchema()`](./docs/Assertions/AssertJsonMatchesSchema.md) | Asserts that a response contains JSON that matches the schema. |
257227
| [`assertXmlMatchesSchema()`](./docs/Assertions/AssertXmlMatchesSchema.md) | Asserts that a response contains XML that matches the schema. |
258228

@@ -298,12 +268,6 @@ Asserts that Scout Query equals Scout Query.
298268

299269
[Read more](<docs/Assertions/AssertScoutQueryEquals.md>).
300270

301-
## [`assertThatResponse` 💀](<docs/Assertions/AssertThatResponse.md>)
302-
303-
Asserts that PSR Response satisfies given constraint (we have a lot of built-in [constraints](src/Constraints/Response) and [responses](src/Responses), but, of course, you can create a custom).
304-
305-
[Read more](<docs/Assertions/AssertThatResponse.md>).
306-
307271
## [`assertXmlMatchesSchema`](<docs/Assertions/AssertXmlMatchesSchema.md>)
308272

309273
Asserts that XML matches schema [XSD](https://en.wikipedia.org/wiki/XML_Schema_(W3C)) or [Relax NG](https://en.wikipedia.org/wiki/RELAX_NG). Validation based on the standard methods of [`DOMDocument`](https://www.php.net/manual/en/class.domdocument.php) class.

packages/testing/UPGRADE.md

+1-4
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ Please also see [changelog](https://github.com/LastDragon-ru/lara-asp/releases)
5454
* [`ScheduleAssertions`][code-links/5bf3a6e818e8ec48]
5555
* [`Override`][code-links/a5e57679c3a947a6]
5656
* [`WithQueryLog`][code-links/e6637d2e31bd9516]
57-
* [`💀RefreshDatabaseIfEmpty`][code-links/1e9b6004b06c7c68]
57+
* `💀\LastDragon_ru\LaraASP\Testing\Database\RefreshDatabaseIfEmpty`
5858
* [`WithTranslations`][code-links/733eb8fbc4b211a5]
5959

6060
```php
@@ -89,9 +89,6 @@ Please also see [changelog](https://github.com/LastDragon-ru/lara-asp/releases)
8989
[code-links/e6637d2e31bd9516]: src/Database/QueryLog/WithQueryLog.php
9090
"\LastDragon_ru\LaraASP\Testing\Database\QueryLog\WithQueryLog"
9191

92-
[code-links/1e9b6004b06c7c68]: src/Database/RefreshDatabaseIfEmpty.php
93-
"\LastDragon_ru\LaraASP\Testing\Database\RefreshDatabaseIfEmpty"
94-
9592
[code-links/733eb8fbc4b211a5]: src/Utils/WithTranslations.php
9693
"\LastDragon_ru\LaraASP\Testing\Utils\WithTranslations"
9794

packages/testing/composer.json

+1-3
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
"psr/http-message": "^1.0.0|^2.0.0",
4141
"sebastian/comparator": "^5.0|^6.0.0",
4242
"sebastian/exporter": "^5.0|^6.0.0",
43-
"symfony/deprecation-contracts": "^3.0.0",
4443
"symfony/filesystem": "^7.0.0",
4544
"symfony/http-foundation": "^7.0.0",
4645
"symfony/mime": "^7.0.0",
@@ -52,8 +51,7 @@
5251
"illuminate/http": "^11.0.8",
5352
"laravel/scout": "^10.8.0",
5453
"orchestra/testbench": "^9.0.0",
55-
"symfony/console": "^7.0.0",
56-
"symfony/http-kernel": "^7.0.0"
54+
"symfony/console": "^7.0.0"
5755
},
5856
"autoload": {
5957
"files": [

packages/testing/docs/Assertions/AssertThatResponse.md

-104
This file was deleted.

packages/testing/docs/Assertions/AssertThatResponseTest.php

-88
This file was deleted.

packages/testing/src/Assertions/ResponseAssertions.php

-19
Original file line numberDiff line numberDiff line change
@@ -3,32 +3,13 @@
33
namespace LastDragon_ru\LaraASP\Testing\Assertions;
44

55
use LastDragon_ru\LaraASP\Testing\Constraints\Response\Response;
6-
use LastDragon_ru\LaraASP\Testing\Package;
76
use PHPUnit\Framework\Assert;
8-
use PHPUnit\Framework\Constraint\Constraint;
97
use Psr\Http\Message\ResponseInterface;
108

11-
use function trigger_deprecation;
12-
139
/**
1410
* @mixin Assert
1511
*/
1612
trait ResponseAssertions {
17-
/**
18-
* Asserts that PSR Response satisfies given constraint.
19-
*
20-
* @deprecated 6.0.0 Please use {@see static::assertPsrResponse()}
21-
*/
22-
public static function assertThatResponse(
23-
ResponseInterface $response,
24-
Constraint $constraint,
25-
string $message = '',
26-
): void {
27-
trigger_deprecation(Package::Name, '6.0.0', 'Please use `static::assertPsrResponse()` instead.');
28-
29-
static::assertThat($response, $constraint, $message);
30-
}
31-
3213
/**
3314
* Asserts that PSR Response satisfies given constraint.
3415
*/

packages/testing/src/Database/RefreshDatabaseIfEmpty.php

-46
This file was deleted.

0 commit comments

Comments
 (0)