From a93f267c0398a288c7e0ba5c35290d011096cc91 Mon Sep 17 00:00:00 2001 From: Jason Varga Date: Mon, 28 Aug 2023 15:40:33 -0400 Subject: [PATCH] adjust tests --- tests/Drivers/StatamicV2ValetDriverTest.php | 31 +++++++++++++++++++ tests/Drivers/StatamicValetDriverTest.php | 16 ++++++---- .../statamic/{statamic/.gitkeep => artisan} | 0 tests/Drivers/projects/statamic/please | 0 .../projects/statamic/public/index.php | 0 .../statamic/public/static/test_.html | 0 .../public/static/test_foo=bar&baz=qux.html | 0 tests/Drivers/projects/statamicv2/index.php | 0 .../projects/statamicv2/statamic/.gitkeep | 0 9 files changed, 41 insertions(+), 6 deletions(-) create mode 100644 tests/Drivers/StatamicV2ValetDriverTest.php rename tests/Drivers/projects/statamic/{statamic/.gitkeep => artisan} (100%) create mode 100644 tests/Drivers/projects/statamic/please create mode 100644 tests/Drivers/projects/statamic/public/index.php create mode 100644 tests/Drivers/projects/statamic/public/static/test_.html create mode 100644 tests/Drivers/projects/statamic/public/static/test_foo=bar&baz=qux.html create mode 100644 tests/Drivers/projects/statamicv2/index.php create mode 100644 tests/Drivers/projects/statamicv2/statamic/.gitkeep diff --git a/tests/Drivers/StatamicV2ValetDriverTest.php b/tests/Drivers/StatamicV2ValetDriverTest.php new file mode 100644 index 0000000..630e6d1 --- /dev/null +++ b/tests/Drivers/StatamicV2ValetDriverTest.php @@ -0,0 +1,31 @@ +assertTrue($driver->serves($this->projectDir('statamicv2'), 'my-site', '/')); + } + + public function test_it_doesnt_serve_non_statamic_projects() + { + $driver = new StatamicV2ValetDriver(); + + $this->assertFalse($driver->serves($this->projectDir('public-with-index-non-laravel'), 'my-site', '/')); + } + + public function test_it_gets_front_controller() + { + $driver = new StatamicV2ValetDriver(); + + $_SERVER['REQUEST_METHOD'] = 'GET'; + $_SERVER['REQUEST_URI'] = '/about/'; + + $projectPath = $this->projectDir('statamicv2'); + $this->assertEquals($projectPath.'/index.php', $driver->frontControllerPath($projectPath, 'my-site', '/')); + } +} diff --git a/tests/Drivers/StatamicValetDriverTest.php b/tests/Drivers/StatamicValetDriverTest.php index ecd0eed..5b41238 100644 --- a/tests/Drivers/StatamicValetDriverTest.php +++ b/tests/Drivers/StatamicValetDriverTest.php @@ -11,21 +11,25 @@ public function test_it_serves_statamic_projects() $this->assertTrue($driver->serves($this->projectDir('statamic'), 'my-site', '/')); } - public function test_it_doesnt_serve_non_statamic_projects() + public function test_it_doesnt_serve_non_statamic_projects_with_public_directory() { $driver = new StatamicValetDriver(); $this->assertFalse($driver->serves($this->projectDir('public-with-index-non-laravel'), 'my-site', '/')); } + public function test_it_doesnt_serve_laravel_projects() + { + $driver = new StatamicValetDriver(); + + $this->assertFalse($driver->serves($this->projectDir('laravel'), 'my-site', '/')); + } + public function test_it_gets_front_controller() { $driver = new StatamicValetDriver(); - $_SERVER['REQUEST_METHOD'] = 'GET'; - $_SERVER['REQUEST_URI'] = '/about/'; - - $projectPath = $this->projectDir('statamicv1'); - $this->assertEquals($projectPath.'/index.php', $driver->frontControllerPath($projectPath, 'my-site', '/')); + $projectPath = $this->projectDir('statamic'); + $this->assertEquals($projectPath.'/public/index.php', $driver->frontControllerPath($projectPath, 'my-site', '/')); } } diff --git a/tests/Drivers/projects/statamic/statamic/.gitkeep b/tests/Drivers/projects/statamic/artisan similarity index 100% rename from tests/Drivers/projects/statamic/statamic/.gitkeep rename to tests/Drivers/projects/statamic/artisan diff --git a/tests/Drivers/projects/statamic/please b/tests/Drivers/projects/statamic/please new file mode 100644 index 0000000..e69de29 diff --git a/tests/Drivers/projects/statamic/public/index.php b/tests/Drivers/projects/statamic/public/index.php new file mode 100644 index 0000000..e69de29 diff --git a/tests/Drivers/projects/statamic/public/static/test_.html b/tests/Drivers/projects/statamic/public/static/test_.html new file mode 100644 index 0000000..e69de29 diff --git a/tests/Drivers/projects/statamic/public/static/test_foo=bar&baz=qux.html b/tests/Drivers/projects/statamic/public/static/test_foo=bar&baz=qux.html new file mode 100644 index 0000000..e69de29 diff --git a/tests/Drivers/projects/statamicv2/index.php b/tests/Drivers/projects/statamicv2/index.php new file mode 100644 index 0000000..e69de29 diff --git a/tests/Drivers/projects/statamicv2/statamic/.gitkeep b/tests/Drivers/projects/statamicv2/statamic/.gitkeep new file mode 100644 index 0000000..e69de29