silverstripe-environmentcheck/tests/Checks/FileWritableCheckTest.php
2021-10-27 18:06:29 +13:00

37 lines
814 B
PHP

<?php
namespace SilverStripe\EnvironmentCheck\Tests\Checks;
use SilverStripe\EnvironmentCheck\Checks\FileWriteableCheck;
use SilverStripe\EnvironmentCheck\EnvironmentCheck;
use SilverStripe\Dev\SapphireTest;
/**
* Class FileWritableCheckTest
*
* @package environmentcheck
*/
class FileWritableCheckTest extends SapphireTest
{
public function testCheckReportsWritablePaths()
{
$check = new FileWriteableCheck(TEMP_FOLDER);
$expected = [
EnvironmentCheck::OK,
''
];
$this->assertEquals($expected, $check->check());
}
public function testCheckReportsNonWritablePaths()
{
$check = new FileWriteableCheck('/var');
$result = $check->check();
$this->assertEquals(EnvironmentCheck::ERROR, $result[0]);
}
}