mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
API Update tests to reflect renamed services
This commit is contained in:
parent
c8865761d1
commit
38070ab2d3
@ -5,6 +5,8 @@ use SilverStripe\Assets\File;
|
||||
use SilverStripe\Control\Session;
|
||||
use SilverStripe\View\Parsers\ShortcodeParser;
|
||||
use SilverStripe\Dev\SapphireTest;
|
||||
use SilverStripe\Assets\Tests\Storage\AssetStoreTest\TestAssetStore;
|
||||
|
||||
|
||||
|
||||
class ErrorPageFileExtensionTest extends SapphireTest {
|
||||
@ -17,7 +19,7 @@ class ErrorPageFileExtensionTest extends SapphireTest {
|
||||
parent::setUp();
|
||||
$this->versionedMode = Versioned::get_reading_mode();
|
||||
Versioned::set_stage(Versioned::DRAFT);
|
||||
AssetStoreTest_SpyStore::activate('ErrorPageFileExtensionTest');
|
||||
TestAssetStore::activate('ErrorPageFileExtensionTest');
|
||||
$file = new File();
|
||||
$file->setFromString('dummy', 'dummy.txt');
|
||||
$file->write();
|
||||
@ -25,7 +27,7 @@ class ErrorPageFileExtensionTest extends SapphireTest {
|
||||
|
||||
public function tearDown() {
|
||||
Versioned::set_reading_mode($this->versionedMode);
|
||||
AssetStoreTest_SpyStore::reset();
|
||||
TestAssetStore::reset();
|
||||
parent::tearDown(); // TODO: Change the autogenerated stub
|
||||
}
|
||||
|
||||
|
@ -4,6 +4,8 @@ use SilverStripe\ORM\Versioning\Versioned;
|
||||
use SilverStripe\CMS\Model\ErrorPage;
|
||||
use SilverStripe\Core\Config\Config;
|
||||
use SilverStripe\Dev\FunctionalTest;
|
||||
use SilverStripe\Assets\Tests\Storage\AssetStoreTest\TestAssetStore;
|
||||
|
||||
|
||||
|
||||
|
||||
@ -25,14 +27,14 @@ class ErrorPageTest extends FunctionalTest {
|
||||
public function setUp() {
|
||||
parent::setUp();
|
||||
// Set temporary asset backend store
|
||||
AssetStoreTest_SpyStore::activate('ErrorPageTest');
|
||||
TestAssetStore::activate('ErrorPageTest');
|
||||
Config::inst()->update('SilverStripe\\CMS\\Model\\ErrorPage', 'enable_static_file', true);
|
||||
Config::inst()->update('SilverStripe\\Control\\Director', 'environment_type', 'live');
|
||||
$this->logInWithPermission('ADMIN');
|
||||
}
|
||||
|
||||
public function tearDown() {
|
||||
AssetStoreTest_SpyStore::reset();
|
||||
TestAssetStore::reset();
|
||||
parent::tearDown();
|
||||
}
|
||||
|
||||
@ -88,7 +90,7 @@ class ErrorPageTest extends FunctionalTest {
|
||||
public function testStaticCaching() {
|
||||
// Test new error code does not have static content
|
||||
$this->assertEmpty(ErrorPage::get_content_for_errorcode('401'));
|
||||
$expectedErrorPagePath = AssetStoreTest_SpyStore::base_path() . '/error-401.html';
|
||||
$expectedErrorPagePath = TestAssetStore::base_path() . '/error-401.html';
|
||||
$this->assertFileNotExists($expectedErrorPagePath, 'Error page is not automatically cached');
|
||||
|
||||
// Write new 401 page
|
||||
@ -101,7 +103,7 @@ class ErrorPageTest extends FunctionalTest {
|
||||
|
||||
// Static cache should now exist
|
||||
$this->assertNotEmpty(ErrorPage::get_content_for_errorcode('401'));
|
||||
$expectedErrorPagePath = AssetStoreTest_SpyStore::base_path() . '/error-401.html';
|
||||
$expectedErrorPagePath = TestAssetStore::base_path() . '/error-401.html';
|
||||
$this->assertFileExists($expectedErrorPagePath, 'Error page is cached');
|
||||
}
|
||||
|
||||
@ -126,7 +128,7 @@ class ErrorPageTest extends FunctionalTest {
|
||||
|
||||
// Static content is not available
|
||||
$this->assertEmpty(ErrorPage::get_content_for_errorcode('405'));
|
||||
$expectedErrorPagePath = AssetStoreTest_SpyStore::base_path() . '/error-405.html';
|
||||
$expectedErrorPagePath = TestAssetStore::base_path() . '/error-405.html';
|
||||
$this->assertFileNotExists($expectedErrorPagePath, 'Error page is not cached in static location');
|
||||
}
|
||||
}
|
||||
|
@ -6,6 +6,8 @@ use SilverStripe\CMS\Model\VirtualPage;
|
||||
use SilverStripe\Assets\File;
|
||||
use SilverStripe\Assets\Filesystem;
|
||||
use SilverStripe\Dev\SapphireTest;
|
||||
use SilverStripe\Assets\Tests\Storage\AssetStoreTest\TestAssetStore;
|
||||
|
||||
|
||||
|
||||
|
||||
@ -20,13 +22,13 @@ class FileLinkTrackingTest extends SapphireTest {
|
||||
|
||||
Versioned::set_stage(Versioned::DRAFT);
|
||||
|
||||
AssetStoreTest_SpyStore::activate('FileLinkTrackingTest');
|
||||
TestAssetStore::activate('FileLinkTrackingTest');
|
||||
$this->logInWithPermission('ADMIN');
|
||||
|
||||
// Write file contents
|
||||
$files = File::get()->exclude('ClassName', 'SilverStripe\\Assets\\Folder');
|
||||
foreach($files as $file) {
|
||||
$destPath = AssetStoreTest_SpyStore::getLocalPath($file);
|
||||
$destPath = TestAssetStore::getLocalPath($file);
|
||||
Filesystem::makeFolder(dirname($destPath));
|
||||
file_put_contents($destPath, str_repeat('x', 1000000));
|
||||
// Ensure files are published, thus have public urls
|
||||
@ -44,7 +46,7 @@ class FileLinkTrackingTest extends SapphireTest {
|
||||
}
|
||||
|
||||
public function tearDown() {
|
||||
AssetStoreTest_SpyStore::reset();
|
||||
TestAssetStore::reset();
|
||||
parent::tearDown();
|
||||
}
|
||||
|
||||
|
@ -7,6 +7,8 @@ use SilverStripe\CMS\Model\VirtualPage;
|
||||
use SilverStripe\CMS\Model\RedirectorPage;
|
||||
use SilverStripe\Assets\File;
|
||||
use SilverStripe\Dev\SapphireTest;
|
||||
use SilverStripe\Assets\Tests\Storage\AssetStoreTest\TestAssetStore;
|
||||
|
||||
|
||||
|
||||
|
||||
@ -23,12 +25,12 @@ class SiteTreeBrokenLinksTest extends SapphireTest {
|
||||
parent::setUp();
|
||||
|
||||
Versioned::set_stage(Versioned::DRAFT);
|
||||
AssetStoreTest_SpyStore::activate('SiteTreeBrokenLinksTest');
|
||||
TestAssetStore::activate('SiteTreeBrokenLinksTest');
|
||||
$this->logInWithPermission('ADMIN');
|
||||
}
|
||||
|
||||
public function tearDown() {
|
||||
AssetStoreTest_SpyStore::reset();
|
||||
TestAssetStore::reset();
|
||||
parent::tearDown();
|
||||
}
|
||||
|
||||
|
@ -6,6 +6,8 @@ use SilverStripe\Assets\Filesystem;
|
||||
use SilverStripe\Forms\HTMLEditor\HTMLEditorField;
|
||||
use SilverStripe\Dev\CSSContentParser;
|
||||
use SilverStripe\Dev\FunctionalTest;
|
||||
use SilverStripe\Assets\Tests\Storage\AssetStoreTest\TestAssetStore;
|
||||
|
||||
|
||||
class SiteTreeHTMLEditorFieldTest extends FunctionalTest {
|
||||
protected static $fixture_file = 'SiteTreeHTMLEditorFieldTest.yml';
|
||||
@ -14,20 +16,20 @@ class SiteTreeHTMLEditorFieldTest extends FunctionalTest {
|
||||
|
||||
public function setUp() {
|
||||
parent::setUp();
|
||||
AssetStoreTest_SpyStore::activate('SiteTreeHTMLEditorFieldTest');
|
||||
TestAssetStore::activate('SiteTreeHTMLEditorFieldTest');
|
||||
$this->logInWithPermission('ADMIN');
|
||||
|
||||
// Write file contents
|
||||
$files = File::get()->exclude('ClassName', 'SilverStripe\\Assets\\Folder');
|
||||
foreach($files as $file) {
|
||||
$destPath = AssetStoreTest_SpyStore::getLocalPath($file);
|
||||
$destPath = TestAssetStore::getLocalPath($file);
|
||||
Filesystem::makeFolder(dirname($destPath));
|
||||
file_put_contents($destPath, str_repeat('x', 1000000));
|
||||
}
|
||||
}
|
||||
|
||||
public function tearDown() {
|
||||
AssetStoreTest_SpyStore::reset();
|
||||
TestAssetStore::reset();
|
||||
parent::tearDown();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user