php-spark/tests/Environment/EnvironmentTest.php
Christopher Vagnetoft 0f45219747 Misc fixes
* Updated build scripts to handle gitless environments a little
  better
* PDO shell plugin improvements
* More tests
2021-12-17 12:51:29 +01:00

42 lines
1.1 KiB
PHP

<?php
namespace Spark\Environment;
class EnvironmentTest extends \PhpUnit\Framework\TestCase
{
/**
* @covers Environment::createFromDirectory
* @covers Environment::getProjectDirectory
*/
public function testCreatingEnvironmentByTraversing()
{
$env = Environment::createFromDirectory(__DIR__, true);
$this->assertInstanceOf(Environment::class, $env);
$this->assertEquals(dirname(__DIR__), $env->getProjectDirectory());
}
/**
* @covers Environment::createFromDirectory
*/
public function testFailingToCreatingEnvironmentFromMissingConfig()
{
$env = Environment::createFromDirectory(__DIR__);
$this->assertNull($env);
}
/**
* @covers Environment::createFromDirectory
* @covers Environment::getProjectDirectory
*/
public function testCreatingEnvironmentDirectly()
{
$env = Environment::createFromDirectory(__DIR__."/..");
$this->assertInstanceOf(Environment::class, $env);
$this->assertEquals(dirname(__DIR__), $env->getProjectDirectory());
}
}