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();
|
|
|
|
}
|
2014-09-07 00:33:46 +02:00
|
|
|
|
|
|
|
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
|
|
|
}
|
2014-09-03 19:07:53 +02:00
|
|
|
|
|
|
|
date_default_timezone_set('UTC');
|