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