Skip to content

Commit

Permalink
Merge pull request #21 from peter-gribanov/test_failed_deserialize
Browse files Browse the repository at this point in the history
Test failed deserialize
  • Loading branch information
peter-gribanov committed Jan 21, 2020
2 parents eae8f5d + d5278f4 commit 23831ef
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions tests/Command/Queue/Serializer/SymfonySerializerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,33 @@ public function testDeserialize(?string $format, string $expected_format): void

$this->assertSame($result, $serializer->deserialize($data));
}

/**
* @dataProvider formats
*
* @param string|null $format
* @param string $expected_format
*/
public function testFailedDeserialize(?string $format, string $expected_format): void
{
$this->expectException(\RuntimeException::class);

$data = 'foo';
$result = 'bar';

$this->serializer
->expects($this->once())
->method('deserialize')
->with($data, Command::class, $expected_format)
->willReturn($result)
;

if ($format) {
$serializer = new SymfonySerializer($this->serializer, $format);
} else {
$serializer = new SymfonySerializer($this->serializer);
}

$serializer->deserialize($data);
}
}

0 comments on commit 23831ef

Please sign in to comment.