2015-09-11 09:13:48 +12:00
|
|
|
<?php
|
|
|
|
|
2017-01-05 11:16:12 +13:00
|
|
|
namespace SilverStripe\EnvironmentCheck\Tests\Checks;
|
|
|
|
|
|
|
|
use SilverStripe\EnvironmentCheck\Checks\FileWriteableCheck;
|
|
|
|
use SilverStripe\EnvironmentCheck\EnvironmentCheck;
|
|
|
|
use SilverStripe\Dev\SapphireTest;
|
|
|
|
|
2015-09-11 09:13:48 +12:00
|
|
|
/**
|
2017-01-05 11:16:12 +13:00
|
|
|
* Class FileWritableCheckTest
|
|
|
|
*
|
|
|
|
* @package environmentcheck
|
2015-09-11 09:13:48 +12:00
|
|
|
*/
|
2015-11-21 19:18:35 +13:00
|
|
|
class FileWritableCheckTest extends SapphireTest
|
|
|
|
{
|
|
|
|
public function testCheckReportsWritablePaths()
|
|
|
|
{
|
|
|
|
$check = new FileWriteableCheck(TEMP_FOLDER);
|
2015-09-11 09:13:48 +12:00
|
|
|
|
2017-03-21 23:57:07 +13:00
|
|
|
$expected = [
|
2015-11-21 19:18:35 +13:00
|
|
|
EnvironmentCheck::OK,
|
2017-01-05 11:16:12 +13:00
|
|
|
''
|
2017-03-21 23:57:07 +13:00
|
|
|
];
|
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 testCheckReportsNonWritablePaths()
|
|
|
|
{
|
|
|
|
$check = new FileWriteableCheck('/var');
|
2015-09-11 09:13:48 +12:00
|
|
|
|
2015-11-21 19:18:35 +13:00
|
|
|
$result = $check->check();
|
2015-09-11 09:13:48 +12:00
|
|
|
|
2015-11-21 19:18:35 +13:00
|
|
|
$this->assertEquals(EnvironmentCheck::ERROR, $result[0]);
|
|
|
|
}
|
2015-09-11 09:13:48 +12:00
|
|
|
}
|