mirror of
https://github.com/laravel/valet.git
synced 2026-02-04 16:10:08 +01:00
Move all drivers to PSR autoload, and write tests
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,5 +1,5 @@
|
||||
.DS_Store
|
||||
vendor/
|
||||
/vendor/
|
||||
composer.lock
|
||||
error.log
|
||||
.idea
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace Valet\Drivers;
|
||||
|
||||
class BasicValetDriver extends ValetDriver
|
||||
{
|
||||
/**
|
||||
@@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace Valet\Drivers;
|
||||
|
||||
class BedrockValetDriver extends BasicValetDriver
|
||||
{
|
||||
/**
|
||||
@@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace Valet\Drivers;
|
||||
|
||||
class CakeValetDriver extends ValetDriver
|
||||
{
|
||||
/**
|
||||
@@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace Valet\Drivers;
|
||||
|
||||
class Concrete5ValetDriver extends BasicValetDriver
|
||||
{
|
||||
/**
|
||||
@@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace Valet\Drivers;
|
||||
|
||||
class ContaoValetDriver extends ValetDriver
|
||||
{
|
||||
/**
|
||||
@@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace Valet\Drivers;
|
||||
|
||||
class CraftValetDriver extends ValetDriver
|
||||
{
|
||||
/**
|
||||
@@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace Valet\Drivers;
|
||||
|
||||
class DrupalValetDriver extends ValetDriver
|
||||
{
|
||||
/**
|
||||
@@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace Valet\Drivers;
|
||||
|
||||
class JigsawValetDriver extends BasicValetDriver
|
||||
{
|
||||
/**
|
||||
@@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace Valet\Drivers;
|
||||
|
||||
class JoomlaValetDriver extends BasicValetDriver
|
||||
{
|
||||
/**
|
||||
@@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace Valet\Drivers;
|
||||
|
||||
class KatanaValetDriver extends BasicValetDriver
|
||||
{
|
||||
/**
|
||||
@@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace Valet\Drivers;
|
||||
|
||||
class KirbyValetDriver extends ValetDriver
|
||||
{
|
||||
/**
|
||||
@@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace Valet\Drivers;
|
||||
|
||||
class LaravelValetDriver extends ValetDriver
|
||||
{
|
||||
/**
|
||||
@@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace Valet\Drivers;
|
||||
|
||||
class Magento2ValetDriver extends ValetDriver
|
||||
{
|
||||
/**
|
||||
@@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace Valet\Drivers;
|
||||
|
||||
class NeosValetDriver extends ValetDriver
|
||||
{
|
||||
/**
|
||||
@@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace Valet\Drivers;
|
||||
|
||||
class SculpinValetDriver extends BasicValetDriver
|
||||
{
|
||||
/**
|
||||
@@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace Valet\Drivers;
|
||||
|
||||
class StatamicV1ValetDriver extends ValetDriver
|
||||
{
|
||||
/**
|
||||
@@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace Valet\Drivers;
|
||||
|
||||
class StatamicValetDriver extends ValetDriver
|
||||
{
|
||||
/**
|
||||
@@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace Valet\Drivers;
|
||||
|
||||
class SymfonyValetDriver extends ValetDriver
|
||||
{
|
||||
/**
|
||||
@@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace Valet\Drivers;
|
||||
|
||||
/**
|
||||
* This driver serves TYPO3 instances (version 7.0 and up). It activates, if it
|
||||
* finds the characteristic typo3/ folder in the document root, serves both
|
||||
@@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace Valet\Drivers;
|
||||
|
||||
abstract class ValetDriver
|
||||
{
|
||||
/**
|
||||
@@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace Valet\Drivers;
|
||||
|
||||
class WordPressValetDriver extends BasicValetDriver
|
||||
{
|
||||
/**
|
||||
@@ -8,6 +8,7 @@
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Question\ConfirmationQuestion;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcher;
|
||||
use Valet\Drivers\ValetDriver;
|
||||
|
||||
use function Valet\info;
|
||||
use function Valet\output;
|
||||
@@ -278,8 +279,6 @@ function (ConsoleCommandEvent $event) {
|
||||
* Determine which Valet driver the current directory is using.
|
||||
*/
|
||||
$app->command('which', function (OutputInterface $output) {
|
||||
require __DIR__.'/drivers/require.php';
|
||||
|
||||
$driver = ValetDriver::assign(getcwd(), basename(getcwd()), '/');
|
||||
|
||||
if ($driver) {
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Basic drivers...
|
||||
*/
|
||||
require_once __DIR__.'/ValetDriver.php';
|
||||
require_once __DIR__.'/BasicValetDriver.php';
|
||||
|
||||
/**
|
||||
* Specific drivers...
|
||||
*/
|
||||
require_once __DIR__.'/CraftValetDriver.php';
|
||||
require_once __DIR__.'/JigsawValetDriver.php';
|
||||
require_once __DIR__.'/KirbyValetDriver.php';
|
||||
require_once __DIR__.'/LaravelValetDriver.php';
|
||||
require_once __DIR__.'/SculpinValetDriver.php';
|
||||
require_once __DIR__.'/StatamicValetDriver.php';
|
||||
require_once __DIR__.'/StatamicV1ValetDriver.php';
|
||||
require_once __DIR__.'/SymfonyValetDriver.php';
|
||||
require_once __DIR__.'/WordPressValetDriver.php';
|
||||
require_once __DIR__.'/BedrockValetDriver.php';
|
||||
require_once __DIR__.'/ContaoValetDriver.php';
|
||||
require_once __DIR__.'/KatanaValetDriver.php';
|
||||
require_once __DIR__.'/CakeValetDriver.php';
|
||||
require_once __DIR__.'/JoomlaValetDriver.php';
|
||||
require_once __DIR__.'/DrupalValetDriver.php';
|
||||
require_once __DIR__.'/Concrete5ValetDriver.php';
|
||||
require_once __DIR__.'/Typo3ValetDriver.php';
|
||||
require_once __DIR__.'/NeosValetDriver.php';
|
||||
require_once __DIR__.'/Magento2ValetDriver.php';
|
||||
@@ -19,7 +19,8 @@
|
||||
"cli/includes/facades.php",
|
||||
"cli/includes/helpers.php",
|
||||
"tests/UsesNullWriter.php",
|
||||
"tests/BaseApplicationTestCase.php"
|
||||
"tests/BaseApplicationTestCase.php",
|
||||
"tests/Drivers/BaseDriverTestCase.php"
|
||||
],
|
||||
"psr-4": {
|
||||
"Valet\\": "cli/Valet/"
|
||||
|
||||
@@ -3,6 +3,9 @@
|
||||
/**
|
||||
* Define the user's "~/.config/valet" path.
|
||||
*/
|
||||
|
||||
use Valet\Drivers\ValetDriver;
|
||||
|
||||
define('VALET_HOME_PATH', posix_getpwuid(fileowner(__FILE__))['dir'].'/.config/valet');
|
||||
define('VALET_STATIC_PREFIX', '41c270e4-5535-4daa-b23e-c269744c2f45');
|
||||
|
||||
@@ -178,8 +181,6 @@ function get_valet_site_path($valetConfig, $siteName, $domain)
|
||||
*/
|
||||
$valetDriver = null;
|
||||
|
||||
require __DIR__.'/cli/drivers/require.php';
|
||||
|
||||
$valetDriver = ValetDriver::assign($valetSitePath, $siteName, $uri);
|
||||
|
||||
if (! $valetDriver) {
|
||||
|
||||
14
tests/Drivers/BaseDriverTestCase.php
Normal file
14
tests/Drivers/BaseDriverTestCase.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
class BaseDriverTestCase extends Yoast\PHPUnitPolyfills\TestCases\TestCase
|
||||
{
|
||||
public function projects(): array
|
||||
{
|
||||
return Filesystem::scanDir(__DIR__.'/projects');
|
||||
}
|
||||
|
||||
public function projectDir(string $name): string
|
||||
{
|
||||
return __DIR__.'/projects/'.$name;
|
||||
}
|
||||
}
|
||||
15
tests/Drivers/BasicValetDriverTest.php
Normal file
15
tests/Drivers/BasicValetDriverTest.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
use Valet\Drivers\BasicValetDriver;
|
||||
|
||||
class BasicValetDriverTest extends BaseDriverTestCase
|
||||
{
|
||||
public function test_it_serves_anything()
|
||||
{
|
||||
$driver = new BasicValetDriver();
|
||||
|
||||
foreach ($this->projects() as $projectDir) {
|
||||
$this->assertTrue($driver->serves($projectDir, 'my-site', '/'));
|
||||
}
|
||||
}
|
||||
}
|
||||
30
tests/Drivers/BedrockValetDriverTest.php
Normal file
30
tests/Drivers/BedrockValetDriverTest.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
use Valet\Drivers\BedrockValetDriver;
|
||||
|
||||
class BedrockValetDriverTest extends BaseDriverTestCase
|
||||
{
|
||||
public function test_it_serves_bedrock_projects()
|
||||
{
|
||||
$driver = new BedrockValetDriver();
|
||||
|
||||
$this->assertTrue($driver->serves($this->projectDir('bedrock'), 'my-site', '/'));
|
||||
}
|
||||
|
||||
public function test_it_doesnt_serve_non_bedrock_projects()
|
||||
{
|
||||
$driver = new BedrockValetDriver();
|
||||
|
||||
$this->assertFalse($driver->serves($this->projectDir('public-with-index-non-laravel'), 'my-site', '/'));
|
||||
}
|
||||
|
||||
public function test_it_gets_front_controller()
|
||||
{
|
||||
$driver = new BedrockValetDriver();
|
||||
|
||||
$_SERVER['HTTP_HOST'] = 'this is set in Valet requests but not phpunit';
|
||||
|
||||
$projectPath = $this->projectDir('bedrock');
|
||||
$this->assertEquals($projectPath.'/web/index.php', $driver->frontControllerPath($projectPath, 'my-site', '/'));
|
||||
}
|
||||
}
|
||||
28
tests/Drivers/CakeValetDriverTest.php
Normal file
28
tests/Drivers/CakeValetDriverTest.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
use Valet\Drivers\CakeValetDriver;
|
||||
|
||||
class CakeValetDriverTest extends BaseDriverTestCase
|
||||
{
|
||||
public function test_it_serves_cake_projects()
|
||||
{
|
||||
$driver = new CakeValetDriver();
|
||||
|
||||
$this->assertTrue($driver->serves($this->projectDir('cake'), 'my-site', '/'));
|
||||
}
|
||||
|
||||
public function test_it_doesnt_serve_non_cake_projects()
|
||||
{
|
||||
$driver = new CakeValetDriver();
|
||||
|
||||
$this->assertFalse($driver->serves($this->projectDir('public-with-index-non-laravel'), 'my-site', '/'));
|
||||
}
|
||||
|
||||
public function test_it_gets_front_controller()
|
||||
{
|
||||
$driver = new CakeValetDriver();
|
||||
|
||||
$projectPath = $this->projectDir('cake');
|
||||
$this->assertEquals($projectPath . '/webroot/index.php', $driver->frontControllerPath($projectPath, 'my-site', '/'));
|
||||
}
|
||||
}
|
||||
28
tests/Drivers/Concrete5ValetDriverTest.php
Normal file
28
tests/Drivers/Concrete5ValetDriverTest.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
use Valet\Drivers\Concrete5ValetDriver;
|
||||
|
||||
class Concrete5ValetDriverTest extends BaseDriverTestCase
|
||||
{
|
||||
public function test_it_serves_concrete5_projects()
|
||||
{
|
||||
$driver = new Concrete5ValetDriver();
|
||||
|
||||
$this->assertTrue($driver->serves($this->projectDir('concrete5'), 'my-site', '/'));
|
||||
}
|
||||
|
||||
public function test_it_doesnt_serve_non_concrete5_projects()
|
||||
{
|
||||
$driver = new Concrete5ValetDriver();
|
||||
|
||||
$this->assertFalse($driver->serves($this->projectDir('public-with-index-non-laravel'), 'my-site', '/'));
|
||||
}
|
||||
|
||||
public function test_it_gets_front_controller()
|
||||
{
|
||||
$driver = new Concrete5ValetDriver();
|
||||
|
||||
$projectPath = $this->projectDir('concrete5');
|
||||
$this->assertEquals($projectPath.'/index.php', $driver->frontControllerPath($projectPath, 'my-site', '/'));
|
||||
}
|
||||
}
|
||||
28
tests/Drivers/ContaoValetDriverTest.php
Normal file
28
tests/Drivers/ContaoValetDriverTest.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
use Valet\Drivers\ContaoValetDriver;
|
||||
|
||||
class ContaoValetDriverTest extends BaseDriverTestCase
|
||||
{
|
||||
public function test_it_serves_contao_projects()
|
||||
{
|
||||
$driver = new ContaoValetDriver();
|
||||
|
||||
$this->assertTrue($driver->serves($this->projectDir('contao'), 'my-site', '/'));
|
||||
}
|
||||
|
||||
public function test_it_doesnt_serve_non_contao_projects()
|
||||
{
|
||||
$driver = new ContaoValetDriver();
|
||||
|
||||
$this->assertFalse($driver->serves($this->projectDir('public-with-index-non-laravel'), 'my-site', '/'));
|
||||
}
|
||||
|
||||
public function test_it_gets_front_controller()
|
||||
{
|
||||
$driver = new ContaoValetDriver();
|
||||
|
||||
$projectPath = $this->projectDir('contao');
|
||||
$this->assertEquals($projectPath . '/web/app.php', $driver->frontControllerPath($projectPath, 'my-site', '/'));
|
||||
}
|
||||
}
|
||||
30
tests/Drivers/CraftValetDriverTest.php
Normal file
30
tests/Drivers/CraftValetDriverTest.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
use Valet\Drivers\CraftValetDriver;
|
||||
|
||||
class CraftValetDriverTest extends BaseDriverTestCase
|
||||
{
|
||||
public function test_it_serves_craft_projects()
|
||||
{
|
||||
$driver = new CraftValetDriver();
|
||||
|
||||
$this->assertTrue($driver->serves($this->projectDir('craft'), 'my-site', '/'));
|
||||
}
|
||||
|
||||
public function test_it_doesnt_serve_non_craft_projects()
|
||||
{
|
||||
$driver = new CraftValetDriver();
|
||||
|
||||
$this->assertFalse($driver->serves($this->projectDir('public-with-index-non-laravel'), 'my-site', '/'));
|
||||
}
|
||||
|
||||
public function test_it_gets_front_controller()
|
||||
{
|
||||
$driver = new CraftValetDriver();
|
||||
|
||||
$_SERVER['HTTP_HOST'] = 'this is set in Valet requests but not phpunit';
|
||||
|
||||
$projectPath = $this->projectDir('craft');
|
||||
$this->assertEquals($projectPath . '/public/index.php', $driver->frontControllerPath($projectPath, 'my-site', '/'));
|
||||
}
|
||||
}
|
||||
30
tests/Drivers/DrupalValetDriverTest.php
Normal file
30
tests/Drivers/DrupalValetDriverTest.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
use Valet\Drivers\DrupalValetDriver;
|
||||
|
||||
class DrupalValetDriverTest extends BaseDriverTestCase
|
||||
{
|
||||
public function test_it_serves_drupal_projects()
|
||||
{
|
||||
$driver = new DrupalValetDriver();
|
||||
|
||||
$this->assertTrue($driver->serves($this->projectDir('drupal'), 'my-site', '/'));
|
||||
}
|
||||
|
||||
public function test_it_doesnt_serve_non_drupal_projects()
|
||||
{
|
||||
$driver = new DrupalValetDriver();
|
||||
|
||||
$this->assertFalse(!! $driver->serves($this->projectDir('public-with-index-non-laravel'), 'my-site', '/'));
|
||||
}
|
||||
|
||||
public function test_it_gets_front_controller()
|
||||
{
|
||||
$driver = new DrupalValetDriver();
|
||||
|
||||
$_SERVER['HTTP_HOST'] = 'this is set in Valet requests but not phpunit';
|
||||
|
||||
$projectPath = $this->projectDir('drupal');
|
||||
$this->assertEquals($projectPath . '/public/index.php', $driver->frontControllerPath($projectPath, 'my-site', '/'));
|
||||
}
|
||||
}
|
||||
27
tests/Drivers/JigsawValetDriverTest.php
Normal file
27
tests/Drivers/JigsawValetDriverTest.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
use Valet\Drivers\JigsawValetDriver;
|
||||
|
||||
class JigsawValetDriverTest extends BaseDriverTestCase
|
||||
{
|
||||
public function test_it_serves_jigsaw_projects()
|
||||
{
|
||||
$driver = new JigsawValetDriver();
|
||||
|
||||
$this->assertTrue($driver->serves($this->projectDir('jigsaw'), 'my-site', '/'));
|
||||
}
|
||||
|
||||
public function test_it_doesnt_serve_non_jigsaw_projects_with_public_directory()
|
||||
{
|
||||
$driver = new JigsawValetDriver();
|
||||
|
||||
$this->assertFalse($driver->serves($this->projectDir('public-with-index-non-laravel'), 'my-site', '/'));
|
||||
}
|
||||
|
||||
public function test_it_mutates_uri()
|
||||
{
|
||||
$driver = new JigsawValetDriver();
|
||||
|
||||
$this->assertEquals('/build_local/about', $driver->mutateUri('/about'));
|
||||
}
|
||||
}
|
||||
30
tests/Drivers/JoomlaValetDriverTest.php
Normal file
30
tests/Drivers/JoomlaValetDriverTest.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
use Valet\Drivers\JoomlaValetDriver;
|
||||
|
||||
class JoomlaValetDriverTest extends BaseDriverTestCase
|
||||
{
|
||||
public function test_it_serves_joomla_projects()
|
||||
{
|
||||
$driver = new JoomlaValetDriver();
|
||||
|
||||
$this->assertTrue($driver->serves($this->projectDir('joomla'), 'my-site', '/'));
|
||||
}
|
||||
|
||||
public function test_it_doesnt_serve_non_joomla_projects_with_public_directory()
|
||||
{
|
||||
$driver = new JoomlaValetDriver();
|
||||
|
||||
$this->assertFalse($driver->serves($this->projectDir('public-with-index-non-laravel'), 'my-site', '/'));
|
||||
}
|
||||
|
||||
public function test_it_gets_front_controller()
|
||||
{
|
||||
$driver = new JoomlaValetDriver();
|
||||
|
||||
$_SERVER['HTTP_HOST'] = 'this is set in Valet requests but not phpunit';
|
||||
|
||||
$projectPath = $this->projectDir('joomla');
|
||||
$this->assertEquals($projectPath.'/index.php', $driver->frontControllerPath($projectPath, 'my-site', '/'));
|
||||
}
|
||||
}
|
||||
27
tests/Drivers/KatanaValetDriverTest.php
Normal file
27
tests/Drivers/KatanaValetDriverTest.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
use Valet\Drivers\KatanaValetDriver;
|
||||
|
||||
class KatanaValetDriverTest extends BaseDriverTestCase
|
||||
{
|
||||
public function test_it_serves_katana_projects()
|
||||
{
|
||||
$driver = new KatanaValetDriver();
|
||||
|
||||
$this->assertTrue($driver->serves($this->projectDir('katana'), 'my-site', '/'));
|
||||
}
|
||||
|
||||
public function test_it_doesnt_serve_non_katana_projects_with_public_directory()
|
||||
{
|
||||
$driver = new KatanaValetDriver();
|
||||
|
||||
$this->assertFalse($driver->serves($this->projectDir('public-with-index-non-laravel'), 'my-site', '/'));
|
||||
}
|
||||
|
||||
public function test_it_mutates_uri()
|
||||
{
|
||||
$driver = new KatanaValetDriver();
|
||||
|
||||
$this->assertEquals('/public/about', $driver->mutateUri('/about'));
|
||||
}
|
||||
}
|
||||
30
tests/Drivers/KirbyValetDriverTest.php
Normal file
30
tests/Drivers/KirbyValetDriverTest.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
use Valet\Drivers\KirbyValetDriver;
|
||||
|
||||
class KirbyValetDriverTest extends BaseDriverTestCase
|
||||
{
|
||||
public function test_it_serves_kirby_projects()
|
||||
{
|
||||
$driver = new KirbyValetDriver();
|
||||
|
||||
$this->assertTrue($driver->serves($this->projectDir('kirby'), 'my-site', '/'));
|
||||
}
|
||||
|
||||
public function test_it_doesnt_serve_non_kirby_projects_with_public_directory()
|
||||
{
|
||||
$driver = new KirbyValetDriver();
|
||||
|
||||
$this->assertFalse($driver->serves($this->projectDir('public-with-index-non-laravel'), 'my-site', '/'));
|
||||
}
|
||||
|
||||
public function test_it_gets_front_controller()
|
||||
{
|
||||
$driver = new KirbyValetDriver();
|
||||
|
||||
$_SERVER['HTTP_HOST'] = 'this is set in Valet requests but not phpunit';
|
||||
|
||||
$projectPath = $this->projectDir('kirby');
|
||||
$this->assertEquals($projectPath . '/index.php', $driver->frontControllerPath($projectPath, 'my-site', '/'));
|
||||
}
|
||||
}
|
||||
28
tests/Drivers/LaravelValetDriverTest.php
Normal file
28
tests/Drivers/LaravelValetDriverTest.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
use Valet\Drivers\LaravelValetDriver;
|
||||
|
||||
class LaravelValetDriverTest extends BaseDriverTestCase
|
||||
{
|
||||
public function test_it_serves_laravel_projects()
|
||||
{
|
||||
$driver = new LaravelValetDriver();
|
||||
|
||||
$this->assertTrue($driver->serves($this->projectDir('laravel'), 'my-site', '/'));
|
||||
}
|
||||
|
||||
public function test_it_doesnt_serve_non_laravel_projects_with_public_directory()
|
||||
{
|
||||
$driver = new LaravelValetDriver();
|
||||
|
||||
$this->assertFalse($driver->serves($this->projectDir('public-with-index-non-laravel'), 'my-site', '/'));
|
||||
}
|
||||
|
||||
public function test_it_gets_front_controller()
|
||||
{
|
||||
$driver = new LaravelValetDriver();
|
||||
|
||||
$projectPath = $this->projectDir('laravel');
|
||||
$this->assertEquals($projectPath.'/public/index.php', $driver->frontControllerPath($projectPath, 'my-site', '/'));
|
||||
}
|
||||
}
|
||||
28
tests/Drivers/Magento2ValetDriverTest.php
Normal file
28
tests/Drivers/Magento2ValetDriverTest.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
use Valet\Drivers\Magento2ValetDriver;
|
||||
|
||||
class Magento2ValetDriverTest extends BaseDriverTestCase
|
||||
{
|
||||
public function test_it_serves_magento2_projects()
|
||||
{
|
||||
$driver = new Magento2ValetDriver();
|
||||
|
||||
$this->assertTrue($driver->serves($this->projectDir('magento2'), 'my-site', '/'));
|
||||
}
|
||||
|
||||
public function test_it_doesnt_serve_non_magento2_projects_with_public_directory()
|
||||
{
|
||||
$driver = new Magento2ValetDriver();
|
||||
|
||||
$this->assertFalse($driver->serves($this->projectDir('public-with-index-non-laravel'), 'my-site', '/'));
|
||||
}
|
||||
|
||||
public function test_it_gets_front_controller()
|
||||
{
|
||||
$driver = new Magento2ValetDriver();
|
||||
|
||||
$projectPath = $this->projectDir('magento2');
|
||||
$this->assertEquals($projectPath . '/pub/index.php', $driver->frontControllerPath($projectPath, 'my-site', '/'));
|
||||
}
|
||||
}
|
||||
28
tests/Drivers/NeosValetDriverTest.php
Normal file
28
tests/Drivers/NeosValetDriverTest.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
use Valet\Drivers\NeosValetDriver;
|
||||
|
||||
class NeosValetDriverTest extends BaseDriverTestCase
|
||||
{
|
||||
public function test_it_serves_neos_projects()
|
||||
{
|
||||
$driver = new NeosValetDriver();
|
||||
|
||||
$this->assertTrue($driver->serves($this->projectDir('neos'), 'my-site', '/'));
|
||||
}
|
||||
|
||||
public function test_it_doesnt_serve_non_neos_projects_with_public_directory()
|
||||
{
|
||||
$driver = new NeosValetDriver();
|
||||
|
||||
$this->assertFalse($driver->serves($this->projectDir('public-with-index-non-laravel'), 'my-site', '/'));
|
||||
}
|
||||
|
||||
public function test_it_gets_front_controller()
|
||||
{
|
||||
$driver = new NeosValetDriver();
|
||||
|
||||
$projectPath = $this->projectDir('neos');
|
||||
$this->assertEquals($projectPath . '/Web/index.php', $driver->frontControllerPath($projectPath, 'my-site', '/'));
|
||||
}
|
||||
}
|
||||
27
tests/Drivers/SculpinValetDriverTest.php
Normal file
27
tests/Drivers/SculpinValetDriverTest.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
use Valet\Drivers\SculpinValetDriver;
|
||||
|
||||
class SculpinValetDriverTest extends BaseDriverTestCase
|
||||
{
|
||||
public function test_it_serves_sculpin_projects()
|
||||
{
|
||||
$driver = new SculpinValetDriver();
|
||||
|
||||
$this->assertTrue($driver->serves($this->projectDir('sculpin'), 'my-site', '/'));
|
||||
}
|
||||
|
||||
public function test_it_doesnt_serve_non_sculpin_projects_with_public_directory()
|
||||
{
|
||||
$driver = new SculpinValetDriver();
|
||||
|
||||
$this->assertFalse($driver->serves($this->projectDir('public-with-index-non-laravel'), 'my-site', '/'));
|
||||
}
|
||||
|
||||
public function test_it_mutates_uri()
|
||||
{
|
||||
$driver = new SculpinValetDriver();
|
||||
|
||||
$this->assertEquals('/output_dev/about', $driver->mutateUri('/about'));
|
||||
}
|
||||
}
|
||||
28
tests/Drivers/StatamicV1ValetDriverTest.php
Normal file
28
tests/Drivers/StatamicV1ValetDriverTest.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
use Valet\Drivers\StatamicV1ValetDriver;
|
||||
|
||||
class StatamicV1ValetDriverTest extends BaseDriverTestCase
|
||||
{
|
||||
public function test_it_serves_statamicv1_projects()
|
||||
{
|
||||
$driver = new StatamicV1ValetDriver();
|
||||
|
||||
$this->assertTrue($driver->serves($this->projectDir('statamicv1'), 'my-site', '/'));
|
||||
}
|
||||
|
||||
public function test_it_doesnt_serve_non_statamicv1_projects()
|
||||
{
|
||||
$driver = new StatamicV1ValetDriver();
|
||||
|
||||
$this->assertFalse($driver->serves($this->projectDir('public-with-index-non-laravel'), 'my-site', '/'));
|
||||
}
|
||||
|
||||
public function test_it_gets_front_controller()
|
||||
{
|
||||
$driver = new StatamicV1ValetDriver();
|
||||
|
||||
$projectPath = $this->projectDir('statamicv1');
|
||||
$this->assertEquals($projectPath.'/index.php', $driver->frontControllerPath($projectPath, 'my-site', '/'));
|
||||
}
|
||||
}
|
||||
31
tests/Drivers/StatamicValetDriverTest.php
Normal file
31
tests/Drivers/StatamicValetDriverTest.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
use Valet\Drivers\StatamicValetDriver;
|
||||
|
||||
class StatamicValetDriverTest extends BaseDriverTestCase
|
||||
{
|
||||
public function test_it_serves_statamic_projects()
|
||||
{
|
||||
$driver = new StatamicValetDriver();
|
||||
|
||||
$this->assertTrue($driver->serves($this->projectDir('statamic'), 'my-site', '/'));
|
||||
}
|
||||
|
||||
public function test_it_doesnt_serve_non_statamic_projects()
|
||||
{
|
||||
$driver = new StatamicValetDriver();
|
||||
|
||||
$this->assertFalse($driver->serves($this->projectDir('public-with-index-non-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', '/'));
|
||||
}
|
||||
}
|
||||
28
tests/Drivers/SymfonyValetDriverTest.php
Normal file
28
tests/Drivers/SymfonyValetDriverTest.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
use Valet\Drivers\SymfonyValetDriver;
|
||||
|
||||
class SymfonyValetDriverTest extends BaseDriverTestCase
|
||||
{
|
||||
public function test_it_serves_symfony_projects()
|
||||
{
|
||||
$driver = new SymfonyValetDriver();
|
||||
|
||||
$this->assertTrue($driver->serves($this->projectDir('symfony'), 'my-site', '/'));
|
||||
}
|
||||
|
||||
public function test_it_doesnt_serve_non_symfony_projects()
|
||||
{
|
||||
$driver = new SymfonyValetDriver();
|
||||
|
||||
$this->assertFalse($driver->serves($this->projectDir('public-with-index-non-laravel'), 'my-site', '/'));
|
||||
}
|
||||
|
||||
public function test_it_gets_front_controller()
|
||||
{
|
||||
$driver = new SymfonyValetDriver();
|
||||
|
||||
$projectPath = $this->projectDir('symfony');
|
||||
$this->assertEquals($projectPath.'/web/app.php', $driver->frontControllerPath($projectPath, 'my-site', '/'));
|
||||
}
|
||||
}
|
||||
28
tests/Drivers/Typo3ValetDriverTest.php
Normal file
28
tests/Drivers/Typo3ValetDriverTest.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
use Valet\Drivers\Typo3ValetDriver;
|
||||
|
||||
class Typo3ValetDriverTest extends BaseDriverTestCase
|
||||
{
|
||||
public function test_it_serves_typo3_projects()
|
||||
{
|
||||
$driver = new Typo3ValetDriver();
|
||||
|
||||
$this->assertTrue($driver->serves($this->projectDir('typo3'), 'my-site', '/'));
|
||||
}
|
||||
|
||||
public function test_it_doesnt_serve_non_typo3_projects()
|
||||
{
|
||||
$driver = new Typo3ValetDriver();
|
||||
|
||||
$this->assertFalse($driver->serves($this->projectDir('public-with-index-non-laravel'), 'my-site', '/'));
|
||||
}
|
||||
|
||||
public function test_it_gets_front_controller()
|
||||
{
|
||||
$driver = new Typo3ValetDriver();
|
||||
|
||||
$projectPath = $this->projectDir('typo3');
|
||||
$this->assertEquals($projectPath.'/web/index.php', $driver->frontControllerPath($projectPath, 'my-site', '/'));
|
||||
}
|
||||
}
|
||||
30
tests/Drivers/WordPressValetDriverTest.php
Normal file
30
tests/Drivers/WordPressValetDriverTest.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
use Valet\Drivers\WordPressValetDriver;
|
||||
|
||||
class WordPressValetDriverTest extends BaseDriverTestCase
|
||||
{
|
||||
public function test_it_serves_wordpress_projects()
|
||||
{
|
||||
$driver = new WordPressValetDriver();
|
||||
|
||||
$this->assertTrue($driver->serves($this->projectDir('wordpress'), 'my-site', '/'));
|
||||
}
|
||||
|
||||
public function test_it_doesnt_serve_non_wordpress_projects()
|
||||
{
|
||||
$driver = new WordPressValetDriver();
|
||||
|
||||
$this->assertFalse($driver->serves($this->projectDir('public-with-index-non-laravel'), 'my-site', '/'));
|
||||
}
|
||||
|
||||
public function test_it_gets_front_controller()
|
||||
{
|
||||
$driver = new WordPressValetDriver();
|
||||
|
||||
$_SERVER['HTTP_HOST'] = 'this is set in Valet requests but not phpunit';
|
||||
|
||||
$projectPath = $this->projectDir('wordpress');
|
||||
$this->assertEquals($projectPath.'/index.php', $driver->frontControllerPath($projectPath, 'my-site', '/'));
|
||||
}
|
||||
}
|
||||
0
tests/Drivers/projects/bedrock/web/app/.gitkeep
Normal file
0
tests/Drivers/projects/bedrock/web/app/.gitkeep
Normal file
0
tests/Drivers/projects/bedrock/web/index.php
Normal file
0
tests/Drivers/projects/bedrock/web/index.php
Normal file
0
tests/Drivers/projects/bedrock/web/wp-config.php
Normal file
0
tests/Drivers/projects/bedrock/web/wp-config.php
Normal file
0
tests/Drivers/projects/cake/bin/cake
Normal file
0
tests/Drivers/projects/cake/bin/cake
Normal file
0
tests/Drivers/projects/cake/webroot/index.php
Normal file
0
tests/Drivers/projects/cake/webroot/index.php
Normal file
0
tests/Drivers/projects/contao/vendor/contao/.gitkeep
vendored
Normal file
0
tests/Drivers/projects/contao/vendor/contao/.gitkeep
vendored
Normal file
0
tests/Drivers/projects/contao/web/app.php
Normal file
0
tests/Drivers/projects/contao/web/app.php
Normal file
0
tests/Drivers/projects/craft/craft
Normal file
0
tests/Drivers/projects/craft/craft
Normal file
0
tests/Drivers/projects/craft/public/index.php
Normal file
0
tests/Drivers/projects/craft/public/index.php
Normal file
0
tests/Drivers/projects/drupal/public/misc/drupal.js
Normal file
0
tests/Drivers/projects/drupal/public/misc/drupal.js
Normal file
0
tests/Drivers/projects/jigsaw/build_local/.gitkeep
Normal file
0
tests/Drivers/projects/jigsaw/build_local/.gitkeep
Normal file
0
tests/Drivers/projects/joomla/index.php
Normal file
0
tests/Drivers/projects/joomla/index.php
Normal file
0
tests/Drivers/projects/katana/katana
Normal file
0
tests/Drivers/projects/katana/katana
Normal file
0
tests/Drivers/projects/kirby/index.php
Normal file
0
tests/Drivers/projects/kirby/index.php
Normal file
0
tests/Drivers/projects/kirby/kirby/.gitkeep
Normal file
0
tests/Drivers/projects/kirby/kirby/.gitkeep
Normal file
0
tests/Drivers/projects/laravel/artisan
Normal file
0
tests/Drivers/projects/laravel/artisan
Normal file
0
tests/Drivers/projects/laravel/public/index.php
Normal file
0
tests/Drivers/projects/laravel/public/index.php
Normal file
0
tests/Drivers/projects/magento2/bin/magento
Normal file
0
tests/Drivers/projects/magento2/bin/magento
Normal file
0
tests/Drivers/projects/magento2/pub/index.php
Normal file
0
tests/Drivers/projects/magento2/pub/index.php
Normal file
0
tests/Drivers/projects/neos/Web/.gitkeep
Normal file
0
tests/Drivers/projects/neos/Web/.gitkeep
Normal file
0
tests/Drivers/projects/neos/flow
Normal file
0
tests/Drivers/projects/neos/flow
Normal file
5
tests/Drivers/projects/sculpin/composer.json
Normal file
5
tests/Drivers/projects/sculpin/composer.json
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"require": {
|
||||
"sculpin/sculpin": "1.0"
|
||||
}
|
||||
}
|
||||
0
tests/Drivers/projects/sculpin/output_dev/.gitkeep
Normal file
0
tests/Drivers/projects/sculpin/output_dev/.gitkeep
Normal file
0
tests/Drivers/projects/sculpin/source/.gitkeep
Normal file
0
tests/Drivers/projects/sculpin/source/.gitkeep
Normal file
0
tests/Drivers/projects/statamic/statamic/.gitkeep
Normal file
0
tests/Drivers/projects/statamic/statamic/.gitkeep
Normal file
0
tests/Drivers/projects/statamicv1/index.php
Normal file
0
tests/Drivers/projects/statamicv1/index.php
Normal file
0
tests/Drivers/projects/symfony/public/index.php
Normal file
0
tests/Drivers/projects/symfony/public/index.php
Normal file
0
tests/Drivers/projects/symfony/src/Kernel.php
Normal file
0
tests/Drivers/projects/symfony/src/Kernel.php
Normal file
0
tests/Drivers/projects/symfony/web/app.php
Normal file
0
tests/Drivers/projects/symfony/web/app.php
Normal file
0
tests/Drivers/projects/typo3/web/typo3/.gitkeep
Normal file
0
tests/Drivers/projects/typo3/web/typo3/.gitkeep
Normal file
0
tests/Drivers/projects/wordpress/index.php
Normal file
0
tests/Drivers/projects/wordpress/index.php
Normal file
0
tests/Drivers/projects/wordpress/wp-config.php
Normal file
0
tests/Drivers/projects/wordpress/wp-config.php
Normal file
Reference in New Issue
Block a user