40 lines
873 B
PHP
Raw Normal View History

2015-09-11 09:13:48 +12:00
<?php
namespace SilverStripe\EnvironmentCheck\Tests\Checks;
use SilverStripe\Dev\SapphireTest;
use SilverStripe\EnvironmentCheck\Checks\HasClassCheck;
use SilverStripe\EnvironmentCheck\EnvironmentCheck;
2015-09-11 09:13:48 +12:00
/**
* Class HasClassCheckTest
*
* @package environmentcheck
2015-09-11 09:13:48 +12:00
*/
2015-11-21 19:18:35 +13:00
class HasClassCheckTest extends SapphireTest
{
public function testCheckReportsMissingClasses()
{
$check = new HasClassCheck('foo');
2015-09-11 09:13:48 +12:00
$expected = [
2015-11-21 19:18:35 +13:00
EnvironmentCheck::ERROR,
'Class foo doesn\'t exist'
];
2015-09-11 09:13:48 +12:00
2015-11-21 19:18:35 +13:00
$this->assertEquals($expected, $check->check());
}
2015-09-11 09:13:48 +12:00
2015-11-21 19:18:35 +13:00
public function testCheckReportsFoundClasses()
{
$check = new HasClassCheck('stdClass');
2015-09-11 09:13:48 +12:00
$expected = [
EnvironmentCheck::OK,
'Class stdClass exists',
];
2015-09-11 09:13:48 +12:00
2015-11-21 19:18:35 +13:00
$this->assertEquals($expected, $check->check());
}
2015-09-11 09:13:48 +12:00
}