diff options
author | Maurício Meneghini Fauth <mauricio@fauth.dev> | 2021-10-06 20:06:03 +0300 |
---|---|---|
committer | Maurício Meneghini Fauth <mauricio@fauth.dev> | 2021-10-06 20:06:03 +0300 |
commit | 75a1b02927a972c58f01c1ed76f02253a6448068 (patch) | |
tree | af9c01a7860766e45b6eb2b15387c7b707fc1fd5 /test | |
parent | 560fb6ff8e21128fabb79e1cf5647d073d4ce09a (diff) |
Add Table\Maintenance\Message value object
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
Diffstat (limited to 'test')
-rw-r--r-- | test/classes/Table/Maintenance/MessageTest.php | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/test/classes/Table/Maintenance/MessageTest.php b/test/classes/Table/Maintenance/MessageTest.php new file mode 100644 index 0000000000..5b3ef75452 --- /dev/null +++ b/test/classes/Table/Maintenance/MessageTest.php @@ -0,0 +1,47 @@ +<?php + +declare(strict_types=1); + +namespace PhpMyAdmin\Tests\Table\Maintenance; + +use PhpMyAdmin\Table\Maintenance\Message; +use PHPUnit\Framework\TestCase; + +/** + * @covers \PhpMyAdmin\Table\Maintenance\Message + */ +class MessageTest extends TestCase +{ + /** + * @param mixed[] $row + * + * @dataProvider providerForTestFromArray + */ + public function testFromArray(array $row, string $table, string $operation, string $type, string $text): void + { + $message = Message::fromArray($row); + $this->assertSame($message->table, $table); + $this->assertSame($message->operation, $operation); + $this->assertSame($message->type, $type); + $this->assertSame($message->text, $text); + } + + /** + * @return array<int|string, array<int, array<string, mixed>|string>> + * @psalm-return array{mixed[], string, string, string, string}[] + */ + public function providerForTestFromArray(): array + { + return [ + [[], '', '', '', ''], + [ + ['Table' => 'sakila.actor', 'Op' => 'analyze', 'Msg_type' => 'status', 'Msg_text' => 'OK'], + 'sakila.actor', + 'analyze', + 'status', + 'OK', + ], + [['Table' => false, 'Op' => false, 'Msg_type' => false, 'Msg_text' => false], '', '', '', ''], + ]; + } +} |