diff --git a/dev/SapphireTest.php b/dev/SapphireTest.php index f6fc4813e..800d1d4ab 100755 --- a/dev/SapphireTest.php +++ b/dev/SapphireTest.php @@ -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; diff --git a/tests/ControllerTest.php b/tests/ControllerTest.php index acc12d586..766e2c4ad 100755 --- a/tests/ControllerTest.php +++ b/tests/ControllerTest.php @@ -1,7 +1,7 @@ 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')); diff --git a/tests/dev/CsvBulkLoaderTest.php b/tests/dev/CsvBulkLoaderTest.php index d42aafc6e..2f0167bfe 100644 --- a/tests/dev/CsvBulkLoaderTest.php +++ b/tests/dev/CsvBulkLoaderTest.php @@ -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', diff --git a/tests/fieldtypes/DecimalTest.php b/tests/fieldtypes/DecimalTest.php index 5d9ad7030..54067380f 100644 --- a/tests/fieldtypes/DecimalTest.php +++ b/tests/fieldtypes/DecimalTest.php @@ -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; diff --git a/tests/filesystem/FileTest.php b/tests/filesystem/FileTest.php index 6c43ed643..9a77e0ce2 100644 --- a/tests/filesystem/FileTest.php +++ b/tests/filesystem/FileTest.php @@ -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. diff --git a/tests/filesystem/FolderTest.php b/tests/filesystem/FolderTest.php index 0dbe6955d..d6dd6dbe9 100644 --- a/tests/filesystem/FolderTest.php +++ b/tests/filesystem/FolderTest.php @@ -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'); diff --git a/tests/filesystem/UploadTest.php b/tests/filesystem/UploadTest.php index f03df9fc4..7782308af 100644 --- a/tests/filesystem/UploadTest.php +++ b/tests/filesystem/UploadTest.php @@ -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 diff --git a/tests/forms/CheckboxSetFieldTest.php b/tests/forms/CheckboxSetFieldTest.php index 03a1f980c..11b80e459 100644 --- a/tests/forms/CheckboxSetFieldTest.php +++ b/tests/forms/CheckboxSetFieldTest.php @@ -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', diff --git a/tests/forms/ComplexTableFieldTest.php b/tests/forms/ComplexTableFieldTest.php index 059770223..6ff4b8e41 100644 --- a/tests/forms/ComplexTableFieldTest.php +++ b/tests/forms/ComplexTableFieldTest.php @@ -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( diff --git a/tests/forms/FormScaffolderTest.php b/tests/forms/FormScaffolderTest.php index 58a47428e..b5cc579c3 100644 --- a/tests/forms/FormScaffolderTest.php +++ b/tests/forms/FormScaffolderTest.php @@ -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', diff --git a/tests/forms/FormTest.php b/tests/forms/FormTest.php index 317a339ce..aaf522800 100755 --- a/tests/forms/FormTest.php +++ b/tests/forms/FormTest.php @@ -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', diff --git a/tests/forms/HtmlEditorFieldTest.php b/tests/forms/HtmlEditorFieldTest.php index 2c9bbe62b..28718a251 100755 --- a/tests/forms/HtmlEditorFieldTest.php +++ b/tests/forms/HtmlEditorFieldTest.php @@ -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; diff --git a/tests/forms/MemberDatetimeOptionsetFieldTest.php b/tests/forms/MemberDatetimeOptionsetFieldTest.php index 8fc54eb70..25f339b61 100644 --- a/tests/forms/MemberDatetimeOptionsetFieldTest.php +++ b/tests/forms/MemberDatetimeOptionsetFieldTest.php @@ -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'; diff --git a/tests/forms/RequirementsTest.php b/tests/forms/RequirementsTest.php index 3c04b2918..71845ada5 100644 --- a/tests/forms/RequirementsTest.php +++ b/tests/forms/RequirementsTest.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' ) ); } @@ -102,7 +106,7 @@ class RequirementsTest extends SapphireTest { /* COMBINED JAVASCRIPT HAS CORRECT CONTENT */ $this->assertTrue((strpos(file_get_contents($combinedFilePath), "alert('b')") !== false), 'combined javascript has correct content'); $this->assertTrue((strpos(file_get_contents($combinedFilePath), "alert('c')") !== false), 'combined javascript has correct content'); - + /* COMBINED FILES ARE NOT INCLUDED TWICE */ $this->assertFalse((bool)preg_match('/src=".*\/RequirementsTest_b\.js/', $html), 'combined files are not included twice'); $this->assertFalse((bool)preg_match('/src=".*\/RequirementsTest_c\.js/', $html), 'combined files are not included twice'); @@ -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); } } diff --git a/tests/forms/TableFieldTest.php b/tests/forms/TableFieldTest.php index 616eb7618..ef009f323 100755 --- a/tests/forms/TableFieldTest.php +++ b/tests/forms/TableFieldTest.php @@ -1,7 +1,7 @@ alternateBasePath = Director::baseFolder() . "/sapphire/tests/i18n/_fakewebroot"; + $this->alternateBasePath = $this->getCurrentAbsolutePath() . "/_fakewebroot"; $this->alternateBaseSavePath = TEMP_FOLDER . '/i18nTextCollectorTest_webroot'; FileSystem::makeFolder($this->alternateBaseSavePath); diff --git a/tests/i18n/i18nTextCollectorTest.php b/tests/i18n/i18nTextCollectorTest.php index a383734b5..bcc759a72 100644 --- a/tests/i18n/i18nTextCollectorTest.php +++ b/tests/i18n/i18nTextCollectorTest.php @@ -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); @@ -572,8 +572,8 @@ 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), diff --git a/tests/model/AggregateTest.php b/tests/model/AggregateTest.php index b9a8351e5..392c91df2 100644 --- a/tests/model/AggregateTest.php +++ b/tests/model/AggregateTest.php @@ -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', diff --git a/tests/model/ComponentSetTest.php b/tests/model/ComponentSetTest.php index 5f91d3b6b..eb8cbf428 100644 --- a/tests/model/ComponentSetTest.php +++ b/tests/model/ComponentSetTest.php @@ -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', diff --git a/tests/model/DbDatetimeTest.php b/tests/model/DbDatetimeTest.php index e5a8f1263..012a96f6b 100644 --- a/tests/model/DbDatetimeTest.php +++ b/tests/model/DbDatetimeTest.php @@ -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'); diff --git a/tests/model/HierarchyTest.php b/tests/model/HierarchyTest.php index 6236cc19d..10685739c 100644 --- a/tests/model/HierarchyTest.php +++ b/tests/model/HierarchyTest.php @@ -1,7 +1,8 @@ array('Hierarchy', 'Versioned') diff --git a/tests/model/ImageTest.php b/tests/model/ImageTest.php index 9f34ab0a9..951ff15cd 100644 --- a/tests/model/ImageTest.php +++ b/tests/model/ImageTest.php @@ -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(); diff --git a/tests/model/MoneyTest.php b/tests/model/MoneyTest.php index 55fa413a3..e9f135bad 100644 --- a/tests/model/MoneyTest.php +++ b/tests/model/MoneyTest.php @@ -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', diff --git a/tests/model/VersionedTest.php b/tests/model/VersionedTest.php index a8c7e6313..53efece11 100644 --- a/tests/model/VersionedTest.php +++ b/tests/model/VersionedTest.php @@ -1,7 +1,7 @@ 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); diff --git a/tests/security/GroupTest.php b/tests/security/GroupTest.php index f4aabd539..a16facd51 100644 --- a/tests/security/GroupTest.php +++ b/tests/security/GroupTest.php @@ -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 diff --git a/tests/security/MemberCsvBulkLoaderTest.php b/tests/security/MemberCsvBulkLoaderTest.php index 7c4ab1b9e..350d0a228 100644 --- a/tests/security/MemberCsvBulkLoaderTest.php +++ b/tests/security/MemberCsvBulkLoaderTest.php @@ -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; diff --git a/tests/security/MemberTest.php b/tests/security/MemberTest.php index e7d5a8b9a..aa137c76b 100644 --- a/tests/security/MemberTest.php +++ b/tests/security/MemberTest.php @@ -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; diff --git a/tests/security/PermissionCheckboxSetFieldTest.php b/tests/security/PermissionCheckboxSetFieldTest.php index b184edb99..7216ed3c0 100644 --- a/tests/security/PermissionCheckboxSetFieldTest.php +++ b/tests/security/PermissionCheckboxSetFieldTest.php @@ -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( diff --git a/tests/security/PermissionRoleTest.php b/tests/security/PermissionRoleTest.php index 3c389078e..c387d9ad4 100644 --- a/tests/security/PermissionRoleTest.php +++ b/tests/security/PermissionRoleTest.php @@ -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'); diff --git a/tests/security/PermissionTest.php b/tests/security/PermissionTest.php index 79139b271..bdae7fffa 100644 --- a/tests/security/PermissionTest.php +++ b/tests/security/PermissionTest.php @@ -1,7 +1,7 @@