2017-01-04 23:16:12 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace SilverStripe\EnvironmentCheck\Tests\Checks;
|
|
|
|
|
|
|
|
use SilverStripe\Dev\SapphireTest;
|
|
|
|
use SilverStripe\EnvironmentCheck\Checks\DatabaseCheck;
|
|
|
|
use SilverStripe\EnvironmentCheck\EnvironmentCheck;
|
|
|
|
use SilverStripe\Security\Member;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Class DatabaseCheckTest
|
|
|
|
*
|
|
|
|
* @mixin PHPUnit_Framework_TestCase
|
|
|
|
*
|
|
|
|
* @package environmentcheck
|
|
|
|
*/
|
|
|
|
class DatabaseCheckTest extends SapphireTest
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* {@inheritDoc}
|
|
|
|
* @var bool
|
|
|
|
*/
|
|
|
|
protected $usesDatabase = true;
|
|
|
|
|
|
|
|
public function testCheckReportsValidConnection()
|
|
|
|
{
|
|
|
|
$member = new Member;
|
|
|
|
$member->FirstName = 'Bob';
|
|
|
|
$member->write();
|
|
|
|
|
|
|
|
$check = new DatabaseCheck();
|
|
|
|
|
2017-03-21 11:57:07 +01:00
|
|
|
$expected = [
|
2017-01-04 23:16:12 +01:00
|
|
|
EnvironmentCheck::OK,
|
|
|
|
''
|
2017-03-21 11:57:07 +01:00
|
|
|
];
|
2017-01-04 23:16:12 +01:00
|
|
|
|
|
|
|
$this->assertEquals($expected, $check->check());
|
|
|
|
}
|
|
|
|
}
|