This repository has been archived on 2025-02-26. You can view files and clone it, but cannot push or open issues or pull requests.
szurubooru/tests/AbstractTestCase.php
2014-10-18 18:48:18 +02:00

34 lines
682 B
PHP

<?php
namespace Szurubooru\Tests;
abstract class AbstractTestCase extends \PHPUnit_Framework_TestCase
{
public function mock($className)
{
return $this->getMockBuilder($className)->disableOriginalConstructor()->getMock();
}
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);
}
}
date_default_timezone_set('UTC');