MINOR Adapted SubsitesVirtualPageTest to changed File API (see r107268)

This commit is contained in:
Ingo Schommer 2010-06-29 06:10:16 +00:00
parent b8213d368a
commit 55214b3e24

View File

@ -6,6 +6,26 @@ class SubsitesVirtualPageTest extends SapphireTest {
'sapphire/tests/FileLinkTrackingTest.yml', 'sapphire/tests/FileLinkTrackingTest.yml',
); );
function setUp() {
parent::setUp();
$this->logInWithPermission('ADMIN');
$fh = fopen(Director::baseFolder() . '/assets/testscript-test-file.pdf', "w");
fwrite($fh, str_repeat('x',1000000));
fclose($fh);
}
function tearDown() {
parent::tearDown();
$testFiles = array(
'/assets/testscript-test-file.pdf',
'/assets/renamed-test-file.pdf',
'/assets/renamed-test-file-second-time.pdf',
);
foreach($testFiles as $file) {
if(file_exists(Director::baseFolder().$file)) unlink(Director::baseFolder().$file);
}
}
// Attempt to bring main:linky to subsite2:linky // Attempt to bring main:linky to subsite2:linky
function testVirtualPageFromAnotherSubsite() { function testVirtualPageFromAnotherSubsite() {
Subsite::$write_hostmap = false; Subsite::$write_hostmap = false;
@ -78,6 +98,7 @@ class SubsitesVirtualPageTest extends SapphireTest {
// Rename the file // Rename the file
$file = $this->objFromFixture('File', 'file1'); $file = $this->objFromFixture('File', 'file1');
$file->Name = 'renamed-test-file.pdf'; $file->Name = 'renamed-test-file.pdf';
$file->write();
// Verify that the draft and publish virtual pages both have the corrected link // Verify that the draft and publish virtual pages both have the corrected link
$this->assertContains('<img src="assets/renamed-test-file.pdf"', $this->assertContains('<img src="assets/renamed-test-file.pdf"',