From 4355eb2352aefb71cdaf25dc5c286afc80360e1d Mon Sep 17 00:00:00 2001 From: Ilya Beliaev Date: Wed, 2 Jul 2025 07:41:42 +0200 Subject: [PATCH] tests added --- .../Parser/SchemaParserFactoryTest.php | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 tests/Integration/Service/Parser/SchemaParserFactoryTest.php diff --git a/tests/Integration/Service/Parser/SchemaParserFactoryTest.php b/tests/Integration/Service/Parser/SchemaParserFactoryTest.php new file mode 100644 index 0000000..0987e22 --- /dev/null +++ b/tests/Integration/Service/Parser/SchemaParserFactoryTest.php @@ -0,0 +1,46 @@ +getMockBuilder(Connection::class) + ->disableOriginalConstructor() + ->onlyMethods(['getDriverName'])->getMock(); + $connection->method('getDriverName')->willReturn($dbType); + + $factory = new SchemaParserFactory(); + self::assertInstanceOf($expectedType, $factory->create($connection)); + } + + public function testFactoryThrowsException(): void + { + $dbType = uniqid('dbType', true); + $connection = $this->getMockBuilder(Connection::class) + ->disableOriginalConstructor() + ->onlyMethods(['getDriverName'])->getMock(); + $connection->method('getDriverName')->willReturn($dbType); + $this->expectException(\InvalidArgumentException::class); + (new SchemaParserFactory())->create($connection); + } +} \ No newline at end of file