mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
MINOR Changed $fixture_path to relative filenames in all sapphire test cases in order to allow easier file moving and less verbosity in tests
This commit is contained in:
parent
14e1341df6
commit
2870eb9212
@ -166,7 +166,7 @@ class SapphireTest extends PHPUnit_Framework_TestCase {
|
||||
}
|
||||
|
||||
if($fixtureFile) {
|
||||
$pathForClass = $this->getCurrentPath();
|
||||
$pathForClass = $this->getCurrentAbsolutePath();
|
||||
$fixtureFiles = (is_array($fixtureFile)) ? $fixtureFile : array($fixtureFile);
|
||||
|
||||
$i = 0;
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
class ControllerTest extends FunctionalTest {
|
||||
static $fixture_file = 'sapphire/tests/ControllerTest.yml';
|
||||
static $fixture_file = 'ControllerTest.yml';
|
||||
|
||||
function testDefaultAction() {
|
||||
/* For a controller with a template, the default action will simple run that template. */
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
class DataObjectDecoratorTest extends SapphireTest {
|
||||
static $fixture_file = 'sapphire/tests/DataObjectDecoratorTest.yml';
|
||||
static $fixture_file = 'DataObjectDecoratorTest.yml';
|
||||
|
||||
protected $extraDataObjects = array(
|
||||
'DataObjectDecoratorTest_Member',
|
||||
|
@ -7,7 +7,7 @@
|
||||
*/
|
||||
class DataObjectSetTest extends SapphireTest {
|
||||
|
||||
static $fixture_file = 'sapphire/tests/DataObjectSetTest.yml';
|
||||
static $fixture_file = 'DataObjectSetTest.yml';
|
||||
|
||||
protected $extraDataObjects = array(
|
||||
'DataObjectTest_Team',
|
||||
|
@ -5,7 +5,7 @@
|
||||
*/
|
||||
class DataObjectTest extends SapphireTest {
|
||||
|
||||
static $fixture_file = 'sapphire/tests/DataObjectTest.yml';
|
||||
static $fixture_file = 'DataObjectTest.yml';
|
||||
|
||||
protected $extraDataObjects = array(
|
||||
'DataObjectTest_Team',
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
class SearchContextTest extends SapphireTest {
|
||||
|
||||
static $fixture_file = 'sapphire/tests/SearchContextTest.yml';
|
||||
static $fixture_file = 'SearchContextTest.yml';
|
||||
|
||||
protected $extraDataObjects = array(
|
||||
'SearchContextTest_Person',
|
||||
|
@ -10,7 +10,7 @@
|
||||
*/
|
||||
class SoapModelAccessTest extends SapphireTest {
|
||||
|
||||
static $fixture_file = 'sapphire/tests/SoapModelAccessTest.yml';
|
||||
static $fixture_file = 'SoapModelAccessTest.yml';
|
||||
|
||||
protected $extraDataObjects = array(
|
||||
'SoapModelAccessTest_Comment',
|
||||
|
@ -8,7 +8,7 @@
|
||||
*/
|
||||
class RestfulServerTest extends SapphireTest {
|
||||
|
||||
static $fixture_file = 'sapphire/tests/api/RestfulServerTest.yml';
|
||||
static $fixture_file = 'RestfulServerTest.yml';
|
||||
|
||||
protected $extraDataObjects = array(
|
||||
'RestfulServerTest_Comment',
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
class XMLDataFormatterTest extends SapphireTest {
|
||||
|
||||
public static $fixture_file = 'sapphire/tests/api/XMLDataFormatterTest.yml';
|
||||
public static $fixture_file = 'XMLDataFormatterTest.yml';
|
||||
|
||||
protected $extraDataObjects = array(
|
||||
'XMLDataFormatterTest_DataObject'
|
||||
|
@ -3,7 +3,7 @@
|
||||
class CSVParserTest extends SapphireTest {
|
||||
function testParsingWithHeaders() {
|
||||
/* By default, a CSV file will be interpreted as having headers */
|
||||
$csv = new CSVParser('sapphire/tests/dev/CsvBulkLoaderTest_PlayersWithHeader.csv');
|
||||
$csv = new CSVParser($this->getCurrentRelativePath() . '/CsvBulkLoaderTest_PlayersWithHeader.csv');
|
||||
|
||||
$firstNames = $birthdays = $biographies = $registered = array();
|
||||
foreach($csv as $record) {
|
||||
@ -28,7 +28,7 @@ class CSVParserTest extends SapphireTest {
|
||||
|
||||
function testParsingWithHeadersAndColumnMap() {
|
||||
/* By default, a CSV file will be interpreted as having headers */
|
||||
$csv = new CSVParser('sapphire/tests/dev/CsvBulkLoaderTest_PlayersWithHeader.csv');
|
||||
$csv = new CSVParser($this->getCurrentRelativePath() . '/CsvBulkLoaderTest_PlayersWithHeader.csv');
|
||||
|
||||
/* We can set up column remapping. The keys are case-insensitive. */
|
||||
$csv->mapColumns(array(
|
||||
@ -58,7 +58,7 @@ class CSVParserTest extends SapphireTest {
|
||||
|
||||
function testParsingWithExplicitHeaderRow() {
|
||||
/* If your CSV file doesn't have a header row */
|
||||
$csv = new CSVParser('sapphire/tests/dev/CsvBulkLoaderTest_PlayersWithHeader.csv');
|
||||
$csv = new CSVParser($this->getCurrentRelativePath() .'/CsvBulkLoaderTest_PlayersWithHeader.csv');
|
||||
|
||||
$csv->provideHeaderRow(array('__fn','__bio','__bd','__reg'));
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
* @todo Test with columnn headers and custom mappings
|
||||
*/
|
||||
class CsvBulkLoaderTest extends SapphireTest {
|
||||
static $fixture_file = 'sapphire/tests/dev/CsvBulkLoaderTest.yml';
|
||||
static $fixture_file = 'CsvBulkLoaderTest.yml';
|
||||
|
||||
protected $extraDataObjects = array(
|
||||
'CsvBulkLoaderTest_Team',
|
||||
@ -18,7 +18,7 @@ class CsvBulkLoaderTest extends SapphireTest {
|
||||
*/
|
||||
function testLoad() {
|
||||
$loader = new CsvBulkLoader('CsvBulkLoaderTest_Player');
|
||||
$filepath = Director::baseFolder() . '/sapphire/tests/dev/CsvBulkLoaderTest_PlayersWithHeader.csv';
|
||||
$filepath = $this->getCurrentAbsolutePath() . '/CsvBulkLoaderTest_PlayersWithHeader.csv';
|
||||
$file = fopen($filepath, 'r');
|
||||
$compareCount = $this->getLineCount($file);
|
||||
fgetcsv($file); // pop header row
|
||||
@ -43,7 +43,7 @@ class CsvBulkLoaderTest extends SapphireTest {
|
||||
*/
|
||||
function testDeleteExistingRecords() {
|
||||
$loader = new CsvBulkLoader('CsvBulkLoaderTest_Player');
|
||||
$filepath = Director::baseFolder() . '/sapphire/tests/dev/CsvBulkLoaderTest_PlayersWithHeader.csv';
|
||||
$filepath = $this->getCurrentAbsolutePath() . '/CsvBulkLoaderTest_PlayersWithHeader.csv';
|
||||
$loader->deleteExistingRecords = true;
|
||||
$results1 = $loader->load($filepath);
|
||||
$this->assertEquals(4, $results1->Count(), 'Test correct count of imported data on first load');
|
||||
@ -59,7 +59,7 @@ class CsvBulkLoaderTest extends SapphireTest {
|
||||
*/
|
||||
function testLoadWithColumnMap() {
|
||||
$loader = new CsvBulkLoader('CsvBulkLoaderTest_Player');
|
||||
$filepath = Director::baseFolder() . '/sapphire/tests/dev/CsvBulkLoaderTest_Players.csv';
|
||||
$filepath = $this->getCurrentAbsolutePath() . '/CsvBulkLoaderTest_Players.csv';
|
||||
$file = fopen($filepath, 'r');
|
||||
$compareCount = $this->getLineCount($file);
|
||||
$compareRow = fgetcsv($file);
|
||||
@ -95,7 +95,7 @@ class CsvBulkLoaderTest extends SapphireTest {
|
||||
*/
|
||||
function testLoadWithCustomHeaderAndRelation() {
|
||||
$loader = new CsvBulkLoader('CsvBulkLoaderTest_Player');
|
||||
$filepath = Director::baseFolder() . '/sapphire/tests/dev/CsvBulkLoaderTest_PlayersWithCustomHeaderAndRelation.csv';
|
||||
$filepath = $this->getCurrentAbsolutePath() . '/CsvBulkLoaderTest_PlayersWithCustomHeaderAndRelation.csv';
|
||||
$file = fopen($filepath, 'r');
|
||||
$compareCount = $this->getLineCount($file);
|
||||
fgetcsv($file); // pop header row
|
||||
@ -145,7 +145,7 @@ class CsvBulkLoaderTest extends SapphireTest {
|
||||
function testLoadWithIdentifiers() {
|
||||
// first load
|
||||
$loader = new CsvBulkLoader('CsvBulkLoaderTest_Player');
|
||||
$filepath = Director::baseFolder() . '/sapphire/tests/dev/CsvBulkLoaderTest_PlayersWithId.csv';
|
||||
$filepath = $this->getCurrentAbsolutePath() . '/CsvBulkLoaderTest_PlayersWithId.csv';
|
||||
$loader->duplicateChecks = array(
|
||||
'ExternalIdentifier' => 'ExternalIdentifier'
|
||||
);
|
||||
@ -168,7 +168,7 @@ class CsvBulkLoaderTest extends SapphireTest {
|
||||
|
||||
function testLoadWithCustomImportMethods() {
|
||||
$loader = new CsvBulkLoaderTest_CustomLoader('CsvBulkLoaderTest_Player');
|
||||
$filepath = Director::baseFolder() . '/sapphire/tests/dev/CsvBulkLoaderTest_PlayersWithHeader.csv';
|
||||
$filepath = $this->getCurrentAbsolutePath() . '/CsvBulkLoaderTest_PlayersWithHeader.csv';
|
||||
$loader->columnMap = array(
|
||||
'FirstName' => '->importFirstName',
|
||||
'Biography' => 'Biography',
|
||||
|
@ -5,7 +5,7 @@
|
||||
*/
|
||||
class DecimalTest extends SapphireTest {
|
||||
|
||||
public static $fixture_file = 'sapphire/tests/fieldtypes/DecimalTest.yml';
|
||||
public static $fixture_file = 'DecimalTest.yml';
|
||||
|
||||
protected $testDataObject;
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
*/
|
||||
class FileTest extends SapphireTest {
|
||||
|
||||
static $fixture_file = 'sapphire/tests/filesystem/FileTest.yml';
|
||||
static $fixture_file = 'FileTest.yml';
|
||||
|
||||
function testCreateWithFilenameWithSubfolder() {
|
||||
// Note: We can't use fixtures/setUp() for this, as we want to create the db record manually.
|
||||
|
@ -8,7 +8,7 @@
|
||||
*/
|
||||
class FolderTest extends SapphireTest {
|
||||
|
||||
static $fixture_file = 'sapphire/tests/filesystem/FileTest.yml';
|
||||
static $fixture_file = 'FileTest.yml';
|
||||
|
||||
function testCreateFromNameAndParentIDSetsFilename() {
|
||||
$folder1 = $this->objFromFixture('Folder', 'folder1');
|
||||
|
@ -4,7 +4,7 @@
|
||||
* @subpackage tests
|
||||
*/
|
||||
class UploadTest extends SapphireTest {
|
||||
static $fixture_file = 'sapphire/tests/filesystem/UploadTest.yml';
|
||||
static $fixture_file = 'UploadTest.yml';
|
||||
|
||||
function testUpload() {
|
||||
// create tmp file
|
||||
|
@ -4,7 +4,7 @@
|
||||
* @subpackage tests
|
||||
*/
|
||||
class CheckboxSetFieldTest extends SapphireTest {
|
||||
static $fixture_file = 'sapphire/tests/forms/CheckboxSetFieldTest.yml';
|
||||
static $fixture_file = 'CheckboxSetFieldTest.yml';
|
||||
|
||||
protected $extraDataObjects = array(
|
||||
'CheckboxSetFieldTest_Article',
|
||||
|
@ -5,7 +5,7 @@
|
||||
*/
|
||||
class ComplexTableFieldTest extends FunctionalTest {
|
||||
|
||||
static $fixture_file = 'sapphire/tests/forms/ComplexTableFieldTest.yml';
|
||||
static $fixture_file = 'ComplexTableFieldTest.yml';
|
||||
static $use_draft_site = true;
|
||||
|
||||
protected $extraDataObjects = array(
|
||||
|
@ -9,7 +9,7 @@
|
||||
*/
|
||||
class FormScaffolderTest extends SapphireTest {
|
||||
|
||||
static $fixture_file = 'sapphire/tests/forms/FormScaffolderTest.yml';
|
||||
static $fixture_file = 'FormScaffolderTest.yml';
|
||||
|
||||
protected $extraDataObjects = array(
|
||||
'FormScaffolderTest_Article',
|
||||
|
@ -5,7 +5,7 @@
|
||||
*/
|
||||
class FormTest extends FunctionalTest {
|
||||
|
||||
static $fixture_file = 'sapphire/tests/forms/FormTest.yml';
|
||||
static $fixture_file = 'FormTest.yml';
|
||||
|
||||
protected $extraDataObjects = array(
|
||||
'FormTest_Player',
|
||||
|
@ -5,7 +5,7 @@
|
||||
*/
|
||||
class HtmlEditorFieldTest extends FunctionalTest {
|
||||
|
||||
public static $fixture_file = 'sapphire/tests/forms/HtmlEditorFieldTest.yml';
|
||||
public static $fixture_file = 'HtmlEditorFieldTest.yml';
|
||||
|
||||
public static $use_draft_site = true;
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
*/
|
||||
class MemberDatetimeOptionsetFieldTest extends SapphireTest {
|
||||
|
||||
public static $fixture_file = 'sapphire/tests/forms/MemberDatetimeOptionsetFieldTest.yml';
|
||||
public static $fixture_file = 'MemberDatetimeOptionsetFieldTest.yml';
|
||||
|
||||
protected function createDateFormatFieldForMember($member) {
|
||||
require_once 'Zend/Date.php';
|
||||
|
@ -42,6 +42,8 @@ class RequirementsTest extends SapphireTest {
|
||||
}
|
||||
|
||||
protected function setupCombinedRequirements($backend) {
|
||||
$basePath = $this->getCurrentRelativePath();
|
||||
|
||||
$backend->clear();
|
||||
$backend->setCombinedFilesFolder('assets');
|
||||
|
||||
@ -50,21 +52,23 @@ class RequirementsTest extends SapphireTest {
|
||||
$backend->delete_combined_files('RequirementsTest_bc.js');
|
||||
|
||||
// require files normally (e.g. called from a FormField instance)
|
||||
$backend->javascript(SAPPHIRE_DIR . '/tests/forms/RequirementsTest_a.js');
|
||||
$backend->javascript(SAPPHIRE_DIR . '/tests/forms/RequirementsTest_b.js');
|
||||
$backend->javascript(SAPPHIRE_DIR . '/tests/forms/RequirementsTest_c.js');
|
||||
$backend->javascript($basePath . '/RequirementsTest_a.js');
|
||||
$backend->javascript($basePath . '/RequirementsTest_b.js');
|
||||
$backend->javascript($basePath . '/RequirementsTest_c.js');
|
||||
|
||||
// require two of those files as combined includes
|
||||
$backend->combine_files(
|
||||
'RequirementsTest_bc.js',
|
||||
array(
|
||||
SAPPHIRE_DIR . '/tests/forms/RequirementsTest_b.js',
|
||||
SAPPHIRE_DIR . '/tests/forms/RequirementsTest_c.js'
|
||||
$basePath . '/RequirementsTest_b.js',
|
||||
$basePath . '/RequirementsTest_c.js'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
protected function setupCombinedNonrequiredRequirements($backend) {
|
||||
$basePath = $this->getCurrentRelativePath();
|
||||
|
||||
$backend->clear();
|
||||
$backend->setCombinedFilesFolder('assets');
|
||||
|
||||
@ -76,8 +80,8 @@ class RequirementsTest extends SapphireTest {
|
||||
$backend->combine_files(
|
||||
'RequirementsTest_bc.js',
|
||||
array(
|
||||
SAPPHIRE_DIR . '/tests/forms/RequirementsTest_b.js',
|
||||
SAPPHIRE_DIR . '/tests/forms/RequirementsTest_c.js'
|
||||
$basePath . '/RequirementsTest_b.js',
|
||||
$basePath . '/RequirementsTest_c.js'
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -141,6 +145,8 @@ class RequirementsTest extends SapphireTest {
|
||||
}
|
||||
|
||||
function testBlockedCombinedJavascript() {
|
||||
$basePath = $this->getCurrentRelativePath();
|
||||
|
||||
$backend = new Requirements_Backend;
|
||||
$backend->set_combined_files_enabled(true);
|
||||
$backend->setCombinedFilesFolder('assets');
|
||||
@ -159,7 +165,7 @@ class RequirementsTest extends SapphireTest {
|
||||
|
||||
/* BLOCKED UNCOMBINED FILES ARE NOT INCLUDED */
|
||||
$this->setupCombinedRequirements($backend);
|
||||
$backend->block('sapphire/tests/forms/RequirementsTest_b.js');
|
||||
$backend->block($basePath .'/RequirementsTest_b.js');
|
||||
$backend->delete_combined_files('RequirementsTest_bc.js');
|
||||
clearstatcache(); // needed to get accurate file_exists() results
|
||||
$html = $backend->includeInHTML(false, self::$html_template);
|
||||
@ -174,8 +180,8 @@ class RequirementsTest extends SapphireTest {
|
||||
@$backend->combine_files(
|
||||
'RequirementsTest_ac.js',
|
||||
array(
|
||||
'sapphire/tests/forms/RequirementsTest_a.js',
|
||||
'sapphire/tests/forms/RequirementsTest_c.js'
|
||||
$basePath . '/RequirementsTest_a.js',
|
||||
$basePath . '/RequirementsTest_c.js'
|
||||
)
|
||||
);
|
||||
|
||||
@ -190,11 +196,13 @@ class RequirementsTest extends SapphireTest {
|
||||
}
|
||||
|
||||
function testArgsInUrls() {
|
||||
$basePath = $this->getCurrentRelativePath();
|
||||
|
||||
$backend = new Requirements_Backend;
|
||||
$backend->set_combined_files_enabled(true);
|
||||
|
||||
$backend->javascript(SAPPHIRE_DIR . '/tests/forms/RequirementsTest_a.js?test=1&test=2&test=3');
|
||||
$backend->css(SAPPHIRE_DIR . '/tests/forms/RequirementsTest_a.css?test=1&test=2&test=3');
|
||||
$backend->javascript($basePath . '/RequirementsTest_a.js?test=1&test=2&test=3');
|
||||
$backend->css($basePath . '/RequirementsTest_a.css?test=1&test=2&test=3');
|
||||
$backend->delete_combined_files('RequirementsTest_bc.js');
|
||||
|
||||
$html = $backend->includeInHTML(false, self::$html_template);
|
||||
@ -207,29 +215,33 @@ class RequirementsTest extends SapphireTest {
|
||||
}
|
||||
|
||||
function testRequirementsBackend() {
|
||||
$basePath = $this->getCurrentRelativePath();
|
||||
|
||||
$backend = new Requirements_Backend();
|
||||
$backend->javascript(SAPPHIRE_DIR . '/tests/forms/a.js');
|
||||
$backend->javascript($basePath . '/a.js');
|
||||
|
||||
$this->assertTrue(count($backend->get_javascript()) == 1, "There should be only 1 file included in required javascript.");
|
||||
$this->assertTrue(in_array(SAPPHIRE_DIR . '/tests/forms/a.js', $backend->get_javascript()), "/test/forms/a.js should be included in required javascript.");
|
||||
$this->assertTrue(in_array($basePath . '/a.js', $backend->get_javascript()), "a.js should be included in required javascript.");
|
||||
|
||||
$backend->javascript(SAPPHIRE_DIR . '/tests/forms/b.js');
|
||||
$backend->javascript($basePath . '/b.js');
|
||||
$this->assertTrue(count($backend->get_javascript()) == 2, "There should be 2 files included in required javascript.");
|
||||
|
||||
$backend->block(SAPPHIRE_DIR . '/tests/forms/a.js');
|
||||
$backend->block($basePath . '/a.js');
|
||||
$this->assertTrue(count($backend->get_javascript()) == 1, "There should be only 1 file included in required javascript.");
|
||||
$this->assertFalse(in_array(SAPPHIRE_DIR . '/tests/forms/a.js', $backend->get_javascript()), "/test/forms/a.js should not be included in required javascript after it has been blocked.");
|
||||
$this->assertTrue(in_array(SAPPHIRE_DIR . '/tests/forms/b.js', $backend->get_javascript()), "/test/forms/b.js should be included in required javascript.");
|
||||
$this->assertFalse(in_array($basePath . '/a.js', $backend->get_javascript()), "a.js should not be included in required javascript after it has been blocked.");
|
||||
$this->assertTrue(in_array($basePath . '/b.js', $backend->get_javascript()), "b.js should be included in required javascript.");
|
||||
|
||||
$backend->css(SAPPHIRE_DIR . '/tests/forms/a.css');
|
||||
$backend->css($basePath . '/a.css');
|
||||
$this->assertTrue(count($backend->get_css()) == 1, "There should be only 1 file included in required css.");
|
||||
$this->assertArrayHasKey(SAPPHIRE_DIR . '/tests/forms/a.css', $backend->get_css(), "/tests/forms/a.css should be in required css.");
|
||||
$this->assertArrayHasKey($basePath . '/a.css', $backend->get_css(), "a.css should be in required css.");
|
||||
|
||||
$backend->block(SAPPHIRE_DIR . '/tests/forms/a.css');
|
||||
$backend->block($basePath . '/a.css');
|
||||
$this->assertTrue(count($backend->get_css()) == 0, "There should be nothing in required css after file has been blocked.");
|
||||
}
|
||||
|
||||
function testConditionalTemplateRequire() {
|
||||
$basePath = $this->getCurrentRelativePath();
|
||||
|
||||
$backend = new RequirementsTest_Backend();
|
||||
$holder = Requirements::backend();
|
||||
Requirements::set_backend($backend);
|
||||
@ -237,19 +249,19 @@ class RequirementsTest extends SapphireTest {
|
||||
'FailTest' => true,
|
||||
));
|
||||
$data->renderWith('RequirementsTest_Conditionals');
|
||||
$backend->assertFileIncluded('css', 'sapphire/tests/forms/RequirementsTest_a.css');
|
||||
$backend->assertFileIncluded('js', array('sapphire/tests/forms/RequirementsTest_b.js', 'sapphire/tests/forms/RequirementsTest_c.js'));
|
||||
$backend->assertFileNotIncluded('js', 'sapphire/tests/forms/RequirementsTest_a.js');
|
||||
$backend->assertFileNotIncluded('css', array('sapphire/tests/forms/RequirementsTest_b.css', 'sapphire/tests/forms/RequirementsTest_c.css'));
|
||||
$backend->assertFileIncluded('css', $basePath .'/RequirementsTest_a.css');
|
||||
$backend->assertFileIncluded('js', array($basePath .'/RequirementsTest_b.js', $basePath .'/RequirementsTest_c.js'));
|
||||
$backend->assertFileNotIncluded('js', $basePath .'/RequirementsTest_a.js');
|
||||
$backend->assertFileNotIncluded('css', array($basePath .'/RequirementsTest_b.css', $basePath .'/RequirementsTest_c.css'));
|
||||
$backend->clear();
|
||||
$data = new ArrayData(array(
|
||||
'FailTest' => false,
|
||||
));
|
||||
$data->renderWith('RequirementsTest_Conditionals');
|
||||
$backend->assertFileNotIncluded('css', 'sapphire/tests/forms/RequirementsTest_a.css');
|
||||
$backend->assertFileNotIncluded('js', array('sapphire/tests/forms/RequirementsTest_b.js', 'sapphire/tests/forms/RequirementsTest_c.js'));
|
||||
$backend->assertFileIncluded('js', 'sapphire/tests/forms/RequirementsTest_a.js');
|
||||
$backend->assertFileIncluded('css', array('sapphire/tests/forms/RequirementsTest_b.css', 'sapphire/tests/forms/RequirementsTest_c.css'));
|
||||
$backend->assertFileNotIncluded('css', $basePath .'/RequirementsTest_a.css');
|
||||
$backend->assertFileNotIncluded('js', array($basePath .'/RequirementsTest_b.js', $basePath .'/RequirementsTest_c.js'));
|
||||
$backend->assertFileIncluded('js', $basePath .'/RequirementsTest_a.js');
|
||||
$backend->assertFileIncluded('css', array($basePath .'/RequirementsTest_b.css', $basePath .'/RequirementsTest_c.css'));
|
||||
Requirements::set_backend($holder);
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
class TableFieldTest extends SapphireTest {
|
||||
static $fixture_file = 'sapphire/tests/forms/TableFieldTest.yml';
|
||||
static $fixture_file = 'TableFieldTest.yml';
|
||||
|
||||
protected $extraDataObjects = array(
|
||||
'TableFieldTest_Object',
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
class TableListFieldTest extends SapphireTest {
|
||||
static $fixture_file = 'sapphire/tests/forms/TableListFieldTest.yml';
|
||||
static $fixture_file = 'TableListFieldTest.yml';
|
||||
|
||||
protected $extraDataObjects = array(
|
||||
'TableListFieldTest_Obj',
|
||||
|
@ -26,7 +26,7 @@ class i18nTest extends SapphireTest {
|
||||
function setUp() {
|
||||
parent::setUp();
|
||||
|
||||
$this->alternateBasePath = Director::baseFolder() . "/sapphire/tests/i18n/_fakewebroot";
|
||||
$this->alternateBasePath = $this->getCurrentAbsolutePath() . "/_fakewebroot";
|
||||
$this->alternateBaseSavePath = TEMP_FOLDER . '/i18nTextCollectorTest_webroot';
|
||||
FileSystem::makeFolder($this->alternateBaseSavePath);
|
||||
|
||||
|
@ -23,7 +23,7 @@ class i18nTextCollectorTest extends SapphireTest {
|
||||
function setUp() {
|
||||
parent::setUp();
|
||||
|
||||
$this->alternateBasePath = Director::baseFolder() . "/sapphire/tests/i18n/_fakewebroot";
|
||||
$this->alternateBasePath = $this->getCurrentAbsolutePath() . "/_fakewebroot";
|
||||
$this->alternateBaseSavePath = TEMP_FOLDER . '/i18nTextCollectorTest_webroot';
|
||||
FileSystem::makeFolder($this->alternateBaseSavePath);
|
||||
|
||||
@ -573,7 +573,7 @@ PHP;
|
||||
function testCollectFromEntityProvidersInCustomObject() {
|
||||
$c = new i18nTextCollector();
|
||||
|
||||
$filePath = Director::baseFolder() . '/sapphire/tests/i18n/i18nTextCollectorTestMyObject.php';
|
||||
$filePath = $this->getCurrentAbsolutePath() . '/i18nTextCollectorTestMyObject.php';
|
||||
$matches = $c->collectFromEntityProviders($filePath);
|
||||
$this->assertEquals(
|
||||
array_keys($matches),
|
||||
|
@ -45,7 +45,7 @@ class AggregateTest_Baz extends DataObject implements TestOnly {
|
||||
}
|
||||
|
||||
class AggregateTest extends SapphireTest {
|
||||
static $fixture_file = 'sapphire/tests/model/AggregateTest.yml';
|
||||
static $fixture_file = 'AggregateTest.yml';
|
||||
|
||||
protected $extraDataObjects = array(
|
||||
'AggregateTest_Foo',
|
||||
|
@ -5,7 +5,7 @@
|
||||
*/
|
||||
class ComponentSetTest extends SapphireTest {
|
||||
|
||||
static $fixture_file = 'sapphire/tests/model/ComponentSetTest.yml';
|
||||
static $fixture_file = 'ComponentSetTest.yml';
|
||||
|
||||
protected $extraDataObjects = array(
|
||||
'ComponentSetTest_Player',
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
class DbDatetimeTest extends FunctionalTest {
|
||||
|
||||
static $fixture_file = 'sapphire/tests/model/DbDatetimeTest.yml';
|
||||
static $fixture_file = 'DbDatetimeTest.yml';
|
||||
|
||||
protected $extraDataObjects = array('DbDatetimeTest_Team');
|
||||
|
||||
|
@ -1,7 +1,8 @@
|
||||
<?php
|
||||
|
||||
class HierarchyTest extends SapphireTest {
|
||||
static $fixture_file = 'sapphire/tests/model/HierarchyTest.yml';
|
||||
|
||||
static $fixture_file = 'HierarchyTest.yml';
|
||||
|
||||
protected $requiredExtensions = array(
|
||||
'HierarchyTest_Object' => array('Hierarchy', 'Versioned')
|
||||
|
@ -6,7 +6,7 @@
|
||||
*/
|
||||
class ImageTest extends SapphireTest {
|
||||
|
||||
static $fixture_file = 'sapphire/tests/model/ImageTest.yml';
|
||||
static $fixture_file = 'ImageTest.yml';
|
||||
|
||||
function setUp() {
|
||||
parent::setUp();
|
||||
|
@ -13,7 +13,7 @@
|
||||
*/
|
||||
class MoneyTest extends SapphireTest {
|
||||
|
||||
static $fixture_file = 'sapphire/tests/model/MoneyTest.yml';
|
||||
static $fixture_file = 'MoneyTest.yml';
|
||||
|
||||
protected $extraDataObjects = array(
|
||||
'MoneyTest_DataObject',
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
class VersionedTest extends SapphireTest {
|
||||
static $fixture_file = 'sapphire/tests/model/VersionedTest.yml';
|
||||
static $fixture_file = 'VersionedTest.yml';
|
||||
|
||||
protected $extraDataObjects = array(
|
||||
'VersionedTest_DataObject',
|
||||
|
@ -9,7 +9,7 @@
|
||||
* @subpackage testing
|
||||
*/
|
||||
class SearchFilterApplyRelationTest extends SapphireTest{
|
||||
static $fixture_file = 'sapphire/tests/search/SearchFilterApplyRelationTest.yml';
|
||||
static $fixture_file = 'SearchFilterApplyRelationTest.yml';
|
||||
|
||||
protected $extraDataObjects = array(
|
||||
'SearchFilterApplyRelationTest_DO',
|
||||
|
@ -8,7 +8,7 @@ class BasicAuthTest extends FunctionalTest {
|
||||
|
||||
static $original_unique_identifier_field;
|
||||
|
||||
static $fixture_file = 'sapphire/tests/security/BasicAuthTest.yml';
|
||||
static $fixture_file = 'BasicAuthTest.yml';
|
||||
|
||||
function setUp() {
|
||||
parent::setUp();
|
||||
@ -113,7 +113,7 @@ class BasicAuthTest_ControllerSecuredWithPermission extends Controller implement
|
||||
|
||||
static $index_called = false;
|
||||
|
||||
protected $template = '../sapphire/templates/BlankPage.ss';
|
||||
protected $template = 'BlankPage';
|
||||
|
||||
function init() {
|
||||
self::$post_init_called = false;
|
||||
@ -135,7 +135,7 @@ class BasicAuthTest_ControllerSecuredWithPermission extends Controller implement
|
||||
|
||||
class BasicAuthTest_ControllerSecuredWithoutPermission extends Controller implements TestOnly {
|
||||
|
||||
protected $template = '../sapphire/templates/BlankPage.ss';
|
||||
protected $template = 'BlankPage';
|
||||
|
||||
function init() {
|
||||
BasicAuth::protect_entire_site(true, null);
|
||||
|
@ -4,11 +4,11 @@
|
||||
* @subpackage tests
|
||||
*/
|
||||
class GroupCsvBulkLoaderTest extends SapphireTest {
|
||||
static $fixture_file = 'sapphire/tests/security/GroupCsvBulkLoaderTest.yml';
|
||||
static $fixture_file = 'GroupCsvBulkLoaderTest.yml';
|
||||
|
||||
function testNewImport() {
|
||||
$loader = new GroupCsvBulkLoader();
|
||||
$results = $loader->load('sapphire/tests/security/GroupCsvBulkLoaderTest.csv');
|
||||
$results = $loader->load($this->getCurrentRelativePath() . '/GroupCsvBulkLoaderTest.csv');
|
||||
$created = $results->Created()->toArray();
|
||||
$this->assertEquals(count($created), 2);
|
||||
$this->assertEquals($created[0]->Code, 'newgroup1');
|
||||
@ -24,7 +24,7 @@ class GroupCsvBulkLoaderTest extends SapphireTest {
|
||||
$existinggroup->write();
|
||||
|
||||
$loader = new GroupCsvBulkLoader();
|
||||
$results = $loader->load('sapphire/tests/security/GroupCsvBulkLoaderTest.csv');
|
||||
$results = $loader->load($this->getCurrentRelativePath() . '/GroupCsvBulkLoaderTest.csv');
|
||||
|
||||
$created = $results->Created()->toArray();
|
||||
$this->assertEquals(count($created), 1);
|
||||
@ -38,7 +38,7 @@ class GroupCsvBulkLoaderTest extends SapphireTest {
|
||||
|
||||
function testImportPermissions() {
|
||||
$loader = new GroupCsvBulkLoader();
|
||||
$results = $loader->load('sapphire/tests/security/GroupCsvBulkLoaderTest_withExisting.csv');
|
||||
$results = $loader->load($this->getCurrentRelativePath() . '/GroupCsvBulkLoaderTest_withExisting.csv');
|
||||
|
||||
$created = $results->Created()->toArray();
|
||||
$this->assertEquals(count($created), 1);
|
||||
|
@ -4,7 +4,7 @@
|
||||
* @subpackage tests
|
||||
*/
|
||||
class GroupTest extends FunctionalTest {
|
||||
static $fixture_file = 'sapphire/tests/security/GroupTest.yml';
|
||||
static $fixture_file = 'GroupTest.yml';
|
||||
|
||||
/**
|
||||
* Test the Group::map() function
|
||||
|
@ -4,11 +4,11 @@
|
||||
* @subpackage tests
|
||||
*/
|
||||
class MemberCsvBulkLoaderTest extends SapphireTest {
|
||||
static $fixture_file = 'sapphire/tests/security/MemberCsvBulkLoaderTest.yml';
|
||||
static $fixture_file = 'MemberCsvBulkLoaderTest.yml';
|
||||
|
||||
function testNewImport() {
|
||||
$loader = new MemberCsvBulkLoader();
|
||||
$results = $loader->load('sapphire/tests/security/MemberCsvBulkLoaderTest.csv');
|
||||
$results = $loader->load($this->getCurrentRelativePath() . '/MemberCsvBulkLoaderTest.csv');
|
||||
$created = $results->Created()->toArray();
|
||||
$this->assertEquals(count($created), 2);
|
||||
$this->assertEquals($created[0]->Email, 'author1@test.com');
|
||||
@ -22,7 +22,7 @@ class MemberCsvBulkLoaderTest extends SapphireTest {
|
||||
$author1->write();
|
||||
|
||||
$loader = new MemberCsvBulkLoader();
|
||||
$results = $loader->load('sapphire/tests/security/MemberCsvBulkLoaderTest.csv');
|
||||
$results = $loader->load($this->getCurrentRelativePath() . '/MemberCsvBulkLoaderTest.csv');
|
||||
$created = $results->Created()->toArray();
|
||||
$this->assertEquals(count($created), 1);
|
||||
$updated = $results->Updated()->toArray();
|
||||
@ -38,7 +38,7 @@ class MemberCsvBulkLoaderTest extends SapphireTest {
|
||||
$loader = new MemberCsvBulkLoader();
|
||||
$loader->setGroups(array($existinggroup));
|
||||
|
||||
$results = $loader->load('sapphire/tests/security/MemberCsvBulkLoaderTest.csv');
|
||||
$results = $loader->load($this->getCurrentRelativePath() . '/MemberCsvBulkLoaderTest.csv');
|
||||
|
||||
$created = $results->Created()->toArray();
|
||||
$this->assertEquals($created[0]->Groups()->column('ID'), array($existinggroup->ID));
|
||||
@ -49,7 +49,7 @@ class MemberCsvBulkLoaderTest extends SapphireTest {
|
||||
$existinggroup = $this->objFromFixture('Group', 'existinggroup');
|
||||
|
||||
$loader = new MemberCsvBulkLoader();
|
||||
$results = $loader->load('sapphire/tests/security/MemberCsvBulkLoaderTest_withGroups.csv');
|
||||
$results = $loader->load($this->getCurrentRelativePath() . '/MemberCsvBulkLoaderTest_withGroups.csv');
|
||||
|
||||
$newgroup = DataObject::get_one('Group', sprintf('"Code" = \'%s\'', 'newgroup'));
|
||||
$this->assertEquals($newgroup->Title, 'newgroup');
|
||||
@ -62,7 +62,7 @@ class MemberCsvBulkLoaderTest extends SapphireTest {
|
||||
function testCleartextPasswordsAreHashedWithDefaultAlgo() {
|
||||
$loader = new MemberCsvBulkLoader();
|
||||
|
||||
$results = $loader->load('sapphire/tests/security/MemberCsvBulkLoaderTest_cleartextpws.csv');
|
||||
$results = $loader->load($this->getCurrentRelativePath() . '/MemberCsvBulkLoaderTest_cleartextpws.csv');
|
||||
|
||||
$member = $results->Created()->First();
|
||||
$memberID = $member->ID;
|
||||
|
@ -4,7 +4,7 @@
|
||||
* @subpackage tests
|
||||
*/
|
||||
class MemberTest extends FunctionalTest {
|
||||
static $fixture_file = 'sapphire/tests/security/MemberTest.yml';
|
||||
static $fixture_file = 'MemberTest.yml';
|
||||
|
||||
protected $orig = array();
|
||||
protected $local = null;
|
||||
|
@ -4,7 +4,7 @@
|
||||
* @subpackage tests
|
||||
*/
|
||||
class PermissionCheckboxSetFieldTest extends SapphireTest {
|
||||
static $fixture_file = 'sapphire/tests/security/PermissionCheckboxSetFieldTest.yml';
|
||||
static $fixture_file = 'PermissionCheckboxSetFieldTest.yml';
|
||||
|
||||
function testHiddenPermissions() {
|
||||
$f = new PermissionCheckboxSetField(
|
||||
|
@ -4,7 +4,7 @@
|
||||
* @subpackage tests
|
||||
*/
|
||||
class PermissionRoleTest extends FunctionalTest {
|
||||
static $fixture_file = 'sapphire/tests/security/PermissionRoleTest.yml';
|
||||
static $fixture_file = 'PermissionRoleTest.yml';
|
||||
|
||||
function testDelete() {
|
||||
$role = $this->objFromFixture('PermissionRole', 'role');
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
class PermissionTest extends SapphireTest {
|
||||
static $fixture_file = 'sapphire/tests/security/PermissionTest.yml';
|
||||
static $fixture_file = 'PermissionTest.yml';
|
||||
|
||||
function testGetCodesGrouped() {
|
||||
$codes = Permission::get_codes();
|
||||
|
@ -6,7 +6,7 @@
|
||||
* @subpackage tests
|
||||
*/
|
||||
class SecurityTest extends FunctionalTest {
|
||||
static $fixture_file = 'sapphire/tests/security/MemberTest.yml';
|
||||
static $fixture_file = 'MemberTest.yml';
|
||||
|
||||
protected $autoFollowRedirection = false;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user