From 13a8aee049aeddccd8bf1a00ef9e9136fddbe0d0 Mon Sep 17 00:00:00 2001 From: NickSdot Date: Wed, 14 Oct 2020 21:31:28 +0800 Subject: [PATCH 1/2] Get root path from already available and correct path of autoloader --- bin/pest | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bin/pest b/bin/pest index 663d549f..c7bba84d 100755 --- a/bin/pest +++ b/bin/pest @@ -19,13 +19,16 @@ use Symfony\Component\Console\Output\OutputInterface; if (file_exists($vendorPath)) { include_once $vendorPath; + $rootPath = dirname($vendorPath, 2); } else { include_once $localPath; + $rootPath = dirname($localPath, 5); } (new Provider())->register(); - $rootPath = getcwd(); + // fallback in case we couldn't find out the path before. + $rootPath = (isset($rootPath) && !empty($rootPath)) ? $rootPath : getcwd(); $testSuite = TestSuite::getInstance($rootPath); From ba08f2c11e00dcd95214f58dd358bd1f0997813c Mon Sep 17 00:00:00 2001 From: NickSdot Date: Thu, 15 Oct 2020 19:46:16 +0800 Subject: [PATCH 2/2] Changes based on feedback https://github.com/pestphp/pest-intellij/issues/73#issuecomment-709201510 --- bin/pest | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bin/pest b/bin/pest index c7bba84d..3ead3c08 100755 --- a/bin/pest +++ b/bin/pest @@ -19,16 +19,16 @@ use Symfony\Component\Console\Output\OutputInterface; if (file_exists($vendorPath)) { include_once $vendorPath; - $rootPath = dirname($vendorPath, 2); + $autoloadPath = $vendorPath; } else { include_once $localPath; - $rootPath = dirname($localPath, 5); + $autoloadPath = $localPath; } (new Provider())->register(); - // fallback in case we couldn't find out the path before. - $rootPath = (isset($rootPath) && !empty($rootPath)) ? $rootPath : getcwd(); + // get $rootPath based on $autoloadPath + $rootPath = dirname($autoloadPath, 2); $testSuite = TestSuite::getInstance($rootPath);