Reset test state for modified config options

This commit is contained in:
Damian Mooyman 2017-09-28 17:24:32 +13:00
parent 53b2fcd1ea
commit f574f6d1b2
No known key found for this signature in database
GPG Key ID: 78B823A10DE27D1A
3 changed files with 34 additions and 9 deletions

View File

@ -9,6 +9,7 @@ SilverStripe\Core\Injector\Injector:
extensions: '%$SilverStripe\Dev\State\ExtensionTestState'
flushable: '%$SilverStripe\Dev\State\FlushableTestState'
requirements: '%$SilverStripe\View\Dev\RequirementsTestState'
ssviewer: '%$SilverStripe\View\Dev\SSViewerTestState'
---
Name: kerneltest
Before: '*'

View File

@ -39,35 +39,29 @@ class ContentNegotiator
/**
* @config
*
* @var string
*/
private static $content_type = '';
/**
* @config
*
* @var string
*/
private static $encoding = 'utf-8';
/**
* @config
*
* @var bool
*/
private static $enabled = false;
/**
* @config
*
* @var bool
*/
protected static $current_enabled = null;
/**
* @config
*
* @var string
*/
private static $default_format = 'html';
@ -97,7 +91,7 @@ class ContentNegotiator
return (substr($response->getBody(), 0, 5) == '<' . '?xml');
}
}
/**
* Gets the current enabled status, if it is not set this will fallback to config
*
@ -110,7 +104,7 @@ class ContentNegotiator
}
return Config::inst()->get(static::class, 'enabled');
}
/**
* Sets the current enabled status
*

View File

@ -0,0 +1,30 @@
<?php
namespace SilverStripe\View\Dev;
use SilverStripe\Control\ContentNegotiator;
use SilverStripe\Dev\SapphireTest;
use SilverStripe\Dev\State\TestState;
use SilverStripe\View\SSViewer;
class SSViewerTestState implements TestState
{
public function setUp(SapphireTest $test)
{
SSViewer::set_themes(null);
SSViewer::setRewriteHashLinksDefault(null);
ContentNegotiator::setEnabled(null);
}
public function tearDown(SapphireTest $test)
{
}
public function setUpOnce($class)
{
}
public function tearDownOnce($class)
{
}
}