diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 31afe8e31..9f953bade 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -11,6 +11,7 @@ xsi:noNamespaceSchemaLocation="/vendor/phpunit/phpunit/phpunit.xsd" cacheDirectory=".phpunit.cache" requireCoverageMetadata="false" + displayDetailsOnTestsThatTriggerWarnings="true" > diff --git a/tests/Unit/EventBus/Serializer/PhpNativeMessageSerializerTest.php b/tests/Unit/EventBus/Serializer/PhpNativeMessageSerializerTest.php index f26a6f031..05d3c16ba 100644 --- a/tests/Unit/EventBus/Serializer/PhpNativeMessageSerializerTest.php +++ b/tests/Unit/EventBus/Serializer/PhpNativeMessageSerializerTest.php @@ -52,13 +52,13 @@ public function testDeserialize(): void ], $message->headers()); } - public function testDeserializeEncodeFailed(): void + public function testDeserializeDecodeFailed(): void { $this->expectException(DeserializeFailed::class); $nativeSerializer = new PhpNativeMessageSerializer(); - $nativeSerializer->deserialize('FOO'); + $nativeSerializer->deserialize('!@#%$^&*()'); } public function testDeserializeNotAMessage(): void diff --git a/tests/Unit/Outbox/DoctrineOutboxStoreTest.php b/tests/Unit/Outbox/DoctrineOutboxStoreTest.php index 83d7429f8..edf1155d1 100644 --- a/tests/Unit/Outbox/DoctrineOutboxStoreTest.php +++ b/tests/Unit/Outbox/DoctrineOutboxStoreTest.php @@ -8,9 +8,7 @@ use Doctrine\DBAL\Connection; use Doctrine\DBAL\Driver; use Doctrine\DBAL\Query\QueryBuilder; -use Doctrine\DBAL\Schema\Column; use Doctrine\DBAL\Schema\Schema; -use Doctrine\DBAL\Schema\Table; use Doctrine\DBAL\Types\Types; use Patchlevel\EventSourcing\EventBus\Message; use Patchlevel\EventSourcing\EventBus\Serializer\MessageSerializer; @@ -212,7 +210,6 @@ public function testRetrieveOutboxMessages(): void public function testConfigureSchema(): void { $connection = $this->prophesize(Connection::class); - $serializer = $this->prophesize(MessageSerializer::class); $doctrineOutboxStore = new DoctrineOutboxStore( @@ -220,30 +217,21 @@ public function testConfigureSchema(): void $serializer->reveal(), ); - $table = $this->prophesize(Table::class); - $column = $this->prophesize(Column::class); - $table->addColumn('id', Types::INTEGER)->shouldBeCalledOnce() - ->willReturn( - $column - ->setNotnull(true)->shouldBeCalledOnce() - ->getObjectProphecy()->setAutoincrement(true)->shouldBeCalledOnce()->willReturn($column->reveal()) - ->getObjectProphecy()->reveal(), - ); - - $column = $this->prophesize(Column::class); - $table->addColumn('message', Types::TEXT)->shouldBeCalledOnce() - ->willReturn( - $column - ->setNotnull(true)->shouldBeCalledOnce() - ->getObjectProphecy()->setLength(16_000)->shouldBeCalledOnce()->willReturn($column->reveal()) - ->getObjectProphecy()->reveal(), - ); - - $table->setPrimaryKey(['id'])->shouldBeCalledOnce(); - - $schema = $this->prophesize(Schema::class); - $schema->createTable('outbox')->shouldBeCalledOnce()->willReturn($table->reveal()); - - $doctrineOutboxStore->configureSchema($schema->reveal(), $connection->reveal()); + $expectedSchema = new Schema(); + $table = $expectedSchema->createTable('outbox'); + + $table->addColumn('id', Types::INTEGER) + ->setNotnull(true) + ->setAutoincrement(true); + $table->addColumn('message', Types::STRING) + ->setNotnull(true) + ->setLength(16_000); + + $table->setPrimaryKey(['id']); + + $schema = new Schema(); + $doctrineOutboxStore->configureSchema($schema, $connection->reveal()); + + $this->assertEquals($expectedSchema, $schema); } }