szurubooru/tests/AbstractTestCase.php

35 lines
682 B
PHP
Raw Normal View History

2014-09-01 20:51:59 +02:00
<?php
namespace Szurubooru\Tests;
abstract class AbstractTestCase extends \PHPUnit_Framework_TestCase
{
public function mock($className)
{
return $this->getMockBuilder($className)->disableOriginalConstructor()->getMock();
}
2014-09-05 20:08:54 +02:00
public function mockConfig()
{
return new ConfigMock();
}
public function getTestDirectory()
{
return __DIR__ . DIRECTORY_SEPARATOR . 'files';
}
protected function tearDown()
{
$this->cleanTestDirectory();
}
private function cleanTestDirectory()
{
foreach (scandir($this->getTestDirectory()) as $fn)
if ($fn{0} != '.')
unlink($this->getTestDirectory() . DIRECTORY_SEPARATOR . $fn);
}
2014-09-01 20:51:59 +02:00
}
date_default_timezone_set('UTC');