1
0
mirror of https://github.com/laravel/valet.git synced 2026-02-06 08:40:09 +01:00

adjust tests

This commit is contained in:
Jason Varga
2023-08-28 15:40:33 -04:00
parent ee5391def6
commit a93f267c03
9 changed files with 41 additions and 6 deletions

View File

@@ -0,0 +1,31 @@
<?php
use Valet\Drivers\Specific\StatamicV2ValetDriver;
class StatamicV2ValetDriverTest extends BaseDriverTestCase
{
public function test_it_serves_statamic_projects()
{
$driver = new StatamicV2ValetDriver();
$this->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', '/'));
}
}

View File

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

View File