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()); 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/', ]); } }