From b0f5821c9157c02823b79429e8e301e8f144f6be Mon Sep 17 00:00:00 2001 From: Vossik Date: Wed, 2 Jun 2021 09:03:35 +0200 Subject: [PATCH 1/2] fixed input path --- src/Command/SqlGeneratorCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Command/SqlGeneratorCommand.php b/src/Command/SqlGeneratorCommand.php index 3efb5af..a55b144 100644 --- a/src/Command/SqlGeneratorCommand.php +++ b/src/Command/SqlGeneratorCommand.php @@ -292,7 +292,7 @@ private function getForeignKey(\ReflectionProperty $property) : ?string private function getBeans(string $destination) : array { $robotLoader = new \Nette\Loaders\RobotLoader(); - $robotLoader->addDirectory(__DIR__ . $destination); + $robotLoader->addDirectory($destination); $robotLoader->rebuild(); $foundClasses = \array_keys($robotLoader->getIndexedClasses()); From be417b3908bcc39635d3df33c778c9709c7720cd Mon Sep 17 00:00:00 2001 From: Vossik Date: Wed, 2 Jun 2021 09:21:13 +0200 Subject: [PATCH 2/2] tests --- tests/Unit/Command/SqlGeneratorCommandTest.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/Unit/Command/SqlGeneratorCommandTest.php b/tests/Unit/Command/SqlGeneratorCommandTest.php index eeca64e..c9e6aa7 100644 --- a/tests/Unit/Command/SqlGeneratorCommandTest.php +++ b/tests/Unit/Command/SqlGeneratorCommandTest.php @@ -115,7 +115,7 @@ public function testSimple() : void $result = $commandTester->execute([ 'command' => 'sqlGenerator', - 'source' => '/../../tests/Unit/TestBean/', + 'source' => __DIR__ . '/../TestBean/', ]); self::assertSame(0, $result); @@ -149,7 +149,7 @@ public function testDuplicateColumns() : void $commandTester->execute([ 'command' => 'sqlGenerator', - 'source' => '/../../tests/Unit/InvalidBean/DuplicateColumns/', + 'source' => __DIR__ . '/../InvalidBean/DuplicateColumns/', ]); } @@ -166,7 +166,7 @@ public function testUndefinedProperty() : void $commandTester->execute([ 'command' => 'sqlGenerator', - 'source' => '/../../tests/Unit/InvalidBean/UndefinedProperty/', + 'source' => __DIR__ . '/../InvalidBean/UndefinedProperty/', ]); } @@ -183,7 +183,7 @@ public function testColumnCount() : void $commandTester->execute([ 'command' => 'sqlGenerator', - 'source' => '/../../tests/Unit/InvalidBean/ColumnCount/', + 'source' => __DIR__ . '/../InvalidBean/ColumnCount/', ]); } }