php-spark/tests/Environment/EnvironmentTest.php

42 lines
1.1 KiB
PHP
Raw Permalink Normal View History

<?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());
}
}