Skip to content

Commit

Permalink
DateFormatTest: Remove dependencies to global/user config
Browse files Browse the repository at this point in the history
refs #6077
  • Loading branch information
mxhash committed Sep 4, 2014
1 parent 6fcf5ec commit 0935a8e
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 29 deletions.
27 changes: 1 addition & 26 deletions test/php/application/views/helpers/DateFormatTest.php
Expand Up @@ -7,24 +7,14 @@
use Mockery;
use Zend_View_Helper_DateFormat;
use Icinga\Test\BaseTestCase;
use Icinga\Application\Config;
use Icinga\Util\DateTimeFactory;

require_once BaseTestCase::$appDir . '/views/helpers/DateFormat.php';

class DateFormatTest extends BaseTestCase
{
public function setUp()
{
parent::setUp();
$this->oldConfigDir = Config::$configDir;
Config::$configDir = dirname(__FILE__) . '/DateFormatTest';
}

public function tearDown()
{
parent::tearDown();
Config::$configDir = $this->oldConfigDir;
DateTimeFactory::setConfig(array('timezone' => date_default_timezone_get()));
}

Expand Down Expand Up @@ -145,21 +135,6 @@ public function testGetDatetimeFormatReturnsFormatFromConfig()

protected function getRequestMock($dateFormat = null, $timeFormat = null)
{
$mock = Mockery::mock('\Zend_Controller_Request_Abstract');
$mock->shouldReceive('getUser->getPreferences->get')
->with(Mockery::type('string'), Mockery::type('string'))
->andReturnUsing(
function ($ident, $default) use ($dateFormat, $timeFormat) {
if ($dateFormat !== null && $ident === 'app.dateFormat') {
return $dateFormat;
} elseif ($timeFormat !== null && $ident === 'app.timeFormat') {
return $timeFormat;
} else {
return $default;
}
}
);

return $mock;
return Mockery::mock('\Zend_Controller_Request_Abstract');
}
}
3 changes: 0 additions & 3 deletions test/php/application/views/helpers/DateFormatTest/config.ini

This file was deleted.

0 comments on commit 0935a8e

Please sign in to comment.