Skip to content

Commit

Permalink
Merge pull request #465 from ergebnis/fix/useless
Browse files Browse the repository at this point in the history
Fix: Remove useless assertions
  • Loading branch information
localheinz authored Dec 30, 2021
2 parents 1d92178 + 31f82fc commit 2b3fa1a
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 26 deletions.
4 changes: 0 additions & 4 deletions test/Unit/ConstructTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,13 @@ public function testFromNameReturnsConstruct(): void

$construct = Construct::fromName($name);

self::assertInstanceOf(Construct::class, $construct);
self::assertSame($name, $construct->name());
}

public function testDefaults(): void
{
$construct = Construct::fromName(self::faker()->word());

self::assertIsArray($construct->fileNames());
self::assertCount(0, $construct->fileNames());
}

Expand Down Expand Up @@ -71,10 +69,8 @@ public function testDefinedInClonesInstanceAndAddsFileNames(): void

$mutated = $construct->definedIn(...$fileNames);

self::assertInstanceOf(Construct::class, $mutated);
self::assertNotSame($construct, $mutated);
self::assertSame($name, $mutated->name());
self::assertIsArray($mutated->fileNames());
self::assertCount(\count($fileNames), $mutated->fileNames());
self::assertEquals($fileNames, $mutated->fileNames());
}
Expand Down
5 changes: 0 additions & 5 deletions test/Unit/Exception/DirectoryDoesNotExistTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
namespace Ergebnis\Classy\Test\Unit\Exception;

use Ergebnis\Classy\Exception\DirectoryDoesNotExist;
use Ergebnis\Classy\Exception\ExceptionInterface;
use Ergebnis\Classy\Test;
use PHPUnit\Framework;

Expand All @@ -33,10 +32,6 @@ public function testFromDirectoryReturnsException(): void

$exception = DirectoryDoesNotExist::fromDirectory($directory);

self::assertInstanceOf(DirectoryDoesNotExist::class, $exception);
self::assertInstanceOf(\InvalidArgumentException::class, $exception);
self::assertInstanceOf(ExceptionInterface::class, $exception);

$message = \sprintf(
'Directory "%s" does not exist.',
$directory
Expand Down
5 changes: 0 additions & 5 deletions test/Unit/Exception/MultipleDefinitionsFoundTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
namespace Ergebnis\Classy\Test\Unit\Exception;

use Ergebnis\Classy\Construct;
use Ergebnis\Classy\Exception\ExceptionInterface;
use Ergebnis\Classy\Exception\MultipleDefinitionsFound;
use Ergebnis\Classy\Test;
use PHPUnit\Framework;
Expand Down Expand Up @@ -45,10 +44,6 @@ public function testFromConstructsReturnsException(): void

$exception = MultipleDefinitionsFound::fromConstructs($constructs);

self::assertInstanceOf(MultipleDefinitionsFound::class, $exception);
self::assertInstanceOf(\RuntimeException::class, $exception);
self::assertInstanceOf(ExceptionInterface::class, $exception);

$format = <<<'PHP'
Multiple definitions have been found for the following constructs:
Expand Down
8 changes: 0 additions & 8 deletions test/Unit/Exception/ParseErrorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

namespace Ergebnis\Classy\Test\Unit\Exception;

use Ergebnis\Classy\Exception\ExceptionInterface;
use Ergebnis\Classy\Exception\ParseError;
use Ergebnis\Classy\Test;
use PHPUnit\Framework;
Expand All @@ -33,9 +32,6 @@ public function testFromParseErrorReturnsException(): void

$exception = ParseError::fromParseError($parseError);

self::assertInstanceOf(ParseError::class, $exception);
self::assertInstanceOf(\ParseError::class, $exception);
self::assertInstanceOf(ExceptionInterface::class, $exception);
self::assertSame($parseError->getMessage(), $exception->getMessage());
self::assertSame(0, $exception->getCode());
self::assertSame($parseError, $exception->getPrevious());
Expand All @@ -51,10 +47,6 @@ public function testFromFileNameAndParseErrorReturnsException(): void
$parseError
);

self::assertInstanceOf(ParseError::class, $exception);
self::assertInstanceOf(\ParseError::class, $exception);
self::assertInstanceOf(ExceptionInterface::class, $exception);

$expectedMessage = \sprintf(
'A parse error occurred when parsing "%s": "%s".',
$fileName,
Expand Down
4 changes: 0 additions & 4 deletions test/Unit/Exception/ShouldNotHappenTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

namespace Ergebnis\Classy\Test\Unit\Exception;

use Ergebnis\Classy\Exception\ExceptionInterface;
use Ergebnis\Classy\Exception\ShouldNotHappen;
use PHPUnit\Framework;

Expand All @@ -28,9 +27,6 @@ public function testCreateReturnsException(): void
{
$exception = ShouldNotHappen::create();

self::assertInstanceOf(ShouldNotHappen::class, $exception);
self::assertInstanceOf(\LogicException::class, $exception);
self::assertInstanceOf(ExceptionInterface::class, $exception);
self::assertSame('This should not happen.', $exception->getMessage());
self::assertSame(0, $exception->getCode());
self::assertNull($exception->getPrevious());
Expand Down

0 comments on commit 2b3fa1a

Please sign in to comment.