forked from opencfp/opencfp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEnvironmentTest.php
42 lines (34 loc) · 1.11 KB
/
EnvironmentTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
namespace OpenCFP\Test;
use OpenCFP\Environment;
/**
* @covers OpenCFP\Environment
*/
class EnvironmentTest extends \PHPUnit_Framework_TestCase
{
/** @test */
public function it_should_encapsulate_valid_environments()
{
$this->assertInstanceOf(Environment::class, Environment::production());
$this->assertEquals('production', Environment::production());
$this->assertEquals('development', Environment::development());
$this->assertEquals('testing', Environment::testing());
}
/** @test */
public function it_should_be_resolvable_from_environment_variable()
{
$_SERVER['CFP_ENV'] = 'testing';
$this->assertEquals('testing', Environment::fromEnvironmentVariable());
}
/** @test */
public function it_should_be_resolvable_from_string()
{
$this->assertEquals('testing', Environment::fromString('testing'));
}
/** @test */
public function it_fails_when_given_an_invalid_environment_string()
{
$this->setExpectedException('InvalidArgumentException');
Environment::fromString('foo');
}
}