2015-09-10 23:13:48 +02:00
|
|
|
<?php
|
|
|
|
|
2017-01-04 23:16:12 +01:00
|
|
|
namespace SilverStripe\EnvironmentCheck\Tests\Checks;
|
|
|
|
|
|
|
|
use SilverStripe\EnvironmentCheck\Checks\HasFunctionCheck;
|
|
|
|
use SilverStripe\EnvironmentCheck\EnvironmentCheck;
|
|
|
|
use SilverStripe\Dev\SapphireTest;
|
|
|
|
|
2015-09-10 23:13:48 +02:00
|
|
|
/**
|
2017-01-04 23:16:12 +01:00
|
|
|
* Class HasFunctionCheckTest
|
|
|
|
*
|
2015-09-10 23:13:48 +02:00
|
|
|
* @mixin PHPUnit_Framework_TestCase
|
2017-01-04 23:16:12 +01:00
|
|
|
*
|
|
|
|
* @package environmentcheck
|
2015-09-10 23:13:48 +02:00
|
|
|
*/
|
2015-11-21 07:18:35 +01:00
|
|
|
class HasFunctionCheckTest extends SapphireTest
|
|
|
|
{
|
|
|
|
public function testCheckReportsMissingFunctions()
|
|
|
|
{
|
|
|
|
$check = new HasFunctionCheck('foo');
|
2015-09-10 23:13:48 +02:00
|
|
|
|
2015-11-21 07:18:35 +01:00
|
|
|
$expected = array(
|
|
|
|
EnvironmentCheck::ERROR,
|
2017-01-04 23:16:12 +01:00
|
|
|
'foo() doesn\'t exist'
|
2015-11-21 07:18:35 +01:00
|
|
|
);
|
2015-09-10 23:13:48 +02:00
|
|
|
|
2015-11-21 07:18:35 +01:00
|
|
|
$this->assertEquals($expected, $check->check());
|
|
|
|
}
|
2015-09-10 23:13:48 +02:00
|
|
|
|
2015-11-21 07:18:35 +01:00
|
|
|
public function testCheckReportsFoundFunctions()
|
|
|
|
{
|
|
|
|
$check = new HasFunctionCheck('class_exists');
|
2015-09-10 23:13:48 +02:00
|
|
|
|
2015-11-21 07:18:35 +01:00
|
|
|
$expected = array(
|
|
|
|
EnvironmentCheck::OK,
|
2017-01-04 23:16:12 +01:00
|
|
|
'class_exists() exists'
|
2015-11-21 07:18:35 +01:00
|
|
|
);
|
2015-09-10 23:13:48 +02:00
|
|
|
|
2015-11-21 07:18:35 +01:00
|
|
|
$this->assertEquals($expected, $check->check());
|
|
|
|
}
|
2015-09-10 23:13:48 +02:00
|
|
|
}
|