From bcccd30bb6892e7975ea43b41f7c523e824260ea Mon Sep 17 00:00:00 2001 From: Dmitry Ivanov Date: Sun, 21 Aug 2022 15:16:11 +0300 Subject: [PATCH] Remove exception assertions --- README.md | 12 ------------ src/Asserts/ExceptionAsserts.php | 20 -------------------- src/TestingTools.php | 2 -- tests/Asserts/ExceptionAssertsTest.php | 17 ----------------- tests/TestingToolsTest.php | 2 -- 5 files changed, 53 deletions(-) delete mode 100644 src/Asserts/ExceptionAsserts.php delete mode 100644 tests/Asserts/ExceptionAssertsTest.php diff --git a/README.md b/README.md index 35832f9..217b949 100644 --- a/README.md +++ b/README.md @@ -87,8 +87,6 @@ Laravel-specific Testing Helpers and Assertions. - [assertDatabaseMissingTable](#assertdatabasemissingtable) - [assertDatabaseHasMany](#assertdatabasehasmany) - [assertDatabaseMissingMany](#assertdatabasemissingmany) -- [ExceptionAsserts](#exceptionasserts) - - [willSeeException](#willseeexception) - [FilesystemAsserts](#filesystemasserts) - [assertDirectoryEmpty](#assertdirectoryempty) - [assertDirectoryNotEmpty](#assertdirectorynotempty) @@ -206,16 +204,6 @@ $this->assertDatabaseMissingMany('posts', [ ]); ``` -### ExceptionAsserts - -#### `willSeeException()` - -Add expectation that the given exception would be thrown: - -```php -$this->willSeeException(RuntimeException::class, 'Oops! Houston, we have a problem!'); -``` - ### FilesystemAsserts #### `assertDirectoryEmpty()` diff --git a/src/Asserts/ExceptionAsserts.php b/src/Asserts/ExceptionAsserts.php deleted file mode 100644 index ca57a15..0000000 --- a/src/Asserts/ExceptionAsserts.php +++ /dev/null @@ -1,20 +0,0 @@ -expectException($class); - - if ($message) { - $this->expectExceptionMessage($message); - } - - $this->expectExceptionCode($code); - } -} diff --git a/src/TestingTools.php b/src/TestingTools.php index 34d254b..8575941 100644 --- a/src/TestingTools.php +++ b/src/TestingTools.php @@ -4,7 +4,6 @@ use Illuminated\Testing\Asserts\CollectionAsserts; use Illuminated\Testing\Asserts\DatabaseAsserts; -use Illuminated\Testing\Asserts\ExceptionAsserts; use Illuminated\Testing\Asserts\FilesystemAsserts; use Illuminated\Testing\Asserts\LogFileAsserts; use Illuminated\Testing\Asserts\ReflectionAsserts; @@ -20,7 +19,6 @@ trait TestingTools /** Asserts */ use CollectionAsserts; use DatabaseAsserts; - use ExceptionAsserts; use FilesystemAsserts; use LogFileAsserts; use ReflectionAsserts; diff --git a/tests/Asserts/ExceptionAssertsTest.php b/tests/Asserts/ExceptionAssertsTest.php deleted file mode 100644 index b430ac9..0000000 --- a/tests/Asserts/ExceptionAssertsTest.php +++ /dev/null @@ -1,17 +0,0 @@ -willSeeException(RuntimeException::class, 'Oops! Houston, we have a problem!'); - - throw new RuntimeException('Oops! Houston, we have a problem!'); - } -} diff --git a/tests/TestingToolsTest.php b/tests/TestingToolsTest.php index 818fc4d..efbd665 100644 --- a/tests/TestingToolsTest.php +++ b/tests/TestingToolsTest.php @@ -4,7 +4,6 @@ use Illuminated\Testing\Asserts\CollectionAsserts; use Illuminated\Testing\Asserts\DatabaseAsserts; -use Illuminated\Testing\Asserts\ExceptionAsserts; use Illuminated\Testing\Asserts\FilesystemAsserts; use Illuminated\Testing\Asserts\LogFileAsserts; use Illuminated\Testing\Asserts\ReflectionAsserts; @@ -26,7 +25,6 @@ public function it_is_using_all_testing_tools_asserts() { $this->assertTraitUsed(TestingTools::class, CollectionAsserts::class); $this->assertTraitUsed(TestingTools::class, DatabaseAsserts::class); - $this->assertTraitUsed(TestingTools::class, ExceptionAsserts::class); $this->assertTraitUsed(TestingTools::class, FilesystemAsserts::class); $this->assertTraitUsed(TestingTools::class, LogFileAsserts::class); $this->assertTraitUsed(TestingTools::class, ReflectionAsserts::class);