mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
removing tailing spaces from model tests
This commit is contained in:
parent
ff4a83f9c8
commit
bcac1a5afc
@ -87,7 +87,7 @@ class DataDifferencerTest_Object extends DataObject implements TestOnly {
|
|||||||
|
|
||||||
return $fields;
|
return $fields;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class DataDifferencerTest_HasOneRelationObject extends DataObject implements TestOnly {
|
class DataDifferencerTest_HasOneRelationObject extends DataObject implements TestOnly {
|
||||||
|
@ -192,7 +192,7 @@ class DataListTest extends SapphireTest {
|
|||||||
|
|
||||||
public function testInnerJoinParameterised() {
|
public function testInnerJoinParameterised() {
|
||||||
$db = DB::get_conn();
|
$db = DB::get_conn();
|
||||||
|
|
||||||
$list = DataObjectTest_TeamComment::get();
|
$list = DataObjectTest_TeamComment::get();
|
||||||
$list = $list->innerJoin(
|
$list = $list->innerJoin(
|
||||||
'DataObjectTest_Team',
|
'DataObjectTest_Team',
|
||||||
@ -958,7 +958,7 @@ class DataListTest extends SapphireTest {
|
|||||||
// Only an explicit NOT NULL should include null values
|
// Only an explicit NOT NULL should include null values
|
||||||
$items6 = $list->filter('Email:not:case', array(null, '', 'damian@thefans.com'));
|
$items6 = $list->filter('Email:not:case', array(null, '', 'damian@thefans.com'));
|
||||||
$this->assertSQLContains(' AND "DataObjectTest_Fan"."Email" IS NOT NULL', $items6->sql());
|
$this->assertSQLContains(' AND "DataObjectTest_Fan"."Email" IS NOT NULL', $items6->sql());
|
||||||
|
|
||||||
// These should all include values where Email IS NULL
|
// These should all include values where Email IS NULL
|
||||||
$items7 = $list->filter('Email:nocase', array(null, '', 'damian@thefans.com'));
|
$items7 = $list->filter('Email:nocase', array(null, '', 'damian@thefans.com'));
|
||||||
$this->assertSQLContains(' OR "DataObjectTest_Fan"."Email" IS NULL', $items7->sql());
|
$this->assertSQLContains(' OR "DataObjectTest_Fan"."Email" IS NULL', $items7->sql());
|
||||||
|
@ -1080,7 +1080,7 @@ class DataObjectTest extends SapphireTest {
|
|||||||
|
|
||||||
public function testValidateModelDefinitionsFailsWithArray() {
|
public function testValidateModelDefinitionsFailsWithArray() {
|
||||||
Config::nest();
|
Config::nest();
|
||||||
|
|
||||||
$object = new DataObjectTest_Team;
|
$object = new DataObjectTest_Team;
|
||||||
$method = $this->makeAccessible($object, 'validateModelDefinitions');
|
$method = $this->makeAccessible($object, 'validateModelDefinitions');
|
||||||
|
|
||||||
@ -1097,7 +1097,7 @@ class DataObjectTest extends SapphireTest {
|
|||||||
|
|
||||||
public function testValidateModelDefinitionsFailsWithIntKey() {
|
public function testValidateModelDefinitionsFailsWithIntKey() {
|
||||||
Config::nest();
|
Config::nest();
|
||||||
|
|
||||||
$object = new DataObjectTest_Team;
|
$object = new DataObjectTest_Team;
|
||||||
$method = $this->makeAccessible($object, 'validateModelDefinitions');
|
$method = $this->makeAccessible($object, 'validateModelDefinitions');
|
||||||
|
|
||||||
@ -1114,7 +1114,7 @@ class DataObjectTest extends SapphireTest {
|
|||||||
|
|
||||||
public function testValidateModelDefinitionsFailsWithIntValue() {
|
public function testValidateModelDefinitionsFailsWithIntValue() {
|
||||||
Config::nest();
|
Config::nest();
|
||||||
|
|
||||||
$object = new DataObjectTest_Team;
|
$object = new DataObjectTest_Team;
|
||||||
$method = $this->makeAccessible($object, 'validateModelDefinitions');
|
$method = $this->makeAccessible($object, 'validateModelDefinitions');
|
||||||
|
|
||||||
@ -1134,7 +1134,7 @@ class DataObjectTest extends SapphireTest {
|
|||||||
*/
|
*/
|
||||||
public function testValidateModelDefinitionsPassesWithExtraFields() {
|
public function testValidateModelDefinitionsPassesWithExtraFields() {
|
||||||
Config::nest();
|
Config::nest();
|
||||||
|
|
||||||
$object = new DataObjectTest_Team;
|
$object = new DataObjectTest_Team;
|
||||||
$method = $this->makeAccessible($object, 'validateModelDefinitions');
|
$method = $this->makeAccessible($object, 'validateModelDefinitions');
|
||||||
|
|
||||||
@ -1778,7 +1778,7 @@ class DataObjectTest_SubTeam extends DataObjectTest_Team implements TestOnly {
|
|||||||
private static $many_many = array(
|
private static $many_many = array(
|
||||||
'FormerPlayers' => 'DataObjectTest_Player'
|
'FormerPlayers' => 'DataObjectTest_Player'
|
||||||
);
|
);
|
||||||
|
|
||||||
private static $many_many_extraFields = array(
|
private static $many_many_extraFields = array(
|
||||||
'FormerPlayers' => array(
|
'FormerPlayers' => array(
|
||||||
'Position' => 'Varchar(100)'
|
'Position' => 'Varchar(100)'
|
||||||
|
@ -195,7 +195,7 @@ class DataQueryTest extends SapphireTest {
|
|||||||
$query = $query->distinct(true);
|
$query = $query->distinct(true);
|
||||||
$this->assertContains('SELECT DISTINCT', $query->sql($params), 'Query contains distinct');
|
$this->assertContains('SELECT DISTINCT', $query->sql($params), 'Query contains distinct');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testComparisonClauseInt() {
|
public function testComparisonClauseInt() {
|
||||||
DB::query("INSERT INTO \"DataQueryTest_F\" (\"SortOrder\") VALUES (2)");
|
DB::query("INSERT INTO \"DataQueryTest_F\" (\"SortOrder\") VALUES (2)");
|
||||||
$query = new DataQuery('DataQueryTest_F');
|
$query = new DataQuery('DataQueryTest_F');
|
||||||
@ -203,7 +203,7 @@ class DataQueryTest extends SapphireTest {
|
|||||||
$this->assertGreaterThan(0, $query->count(), "Couldn't find SortOrder");
|
$this->assertGreaterThan(0, $query->count(), "Couldn't find SortOrder");
|
||||||
$this->resetDBSchema(true);
|
$this->resetDBSchema(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testComparisonClauseDateFull() {
|
public function testComparisonClauseDateFull() {
|
||||||
DB::query("INSERT INTO \"DataQueryTest_F\" (\"MyDate\") VALUES ('1988-03-04 06:30')");
|
DB::query("INSERT INTO \"DataQueryTest_F\" (\"MyDate\") VALUES ('1988-03-04 06:30')");
|
||||||
$query = new DataQuery('DataQueryTest_F');
|
$query = new DataQuery('DataQueryTest_F');
|
||||||
@ -211,7 +211,7 @@ class DataQueryTest extends SapphireTest {
|
|||||||
$this->assertGreaterThan(0, $query->count(), "Couldn't find MyDate");
|
$this->assertGreaterThan(0, $query->count(), "Couldn't find MyDate");
|
||||||
$this->resetDBSchema(true);
|
$this->resetDBSchema(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testComparisonClauseDateStartsWith() {
|
public function testComparisonClauseDateStartsWith() {
|
||||||
DB::query("INSERT INTO \"DataQueryTest_F\" (\"MyDate\") VALUES ('1988-03-04 06:30')");
|
DB::query("INSERT INTO \"DataQueryTest_F\" (\"MyDate\") VALUES ('1988-03-04 06:30')");
|
||||||
$query = new DataQuery('DataQueryTest_F');
|
$query = new DataQuery('DataQueryTest_F');
|
||||||
@ -219,7 +219,7 @@ class DataQueryTest extends SapphireTest {
|
|||||||
$this->assertGreaterThan(0, $query->count(), "Couldn't find MyDate");
|
$this->assertGreaterThan(0, $query->count(), "Couldn't find MyDate");
|
||||||
$this->resetDBSchema(true);
|
$this->resetDBSchema(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testComparisonClauseDateStartsPartial() {
|
public function testComparisonClauseDateStartsPartial() {
|
||||||
DB::query("INSERT INTO \"DataQueryTest_F\" (\"MyDate\") VALUES ('1988-03-04 06:30')");
|
DB::query("INSERT INTO \"DataQueryTest_F\" (\"MyDate\") VALUES ('1988-03-04 06:30')");
|
||||||
$query = new DataQuery('DataQueryTest_F');
|
$query = new DataQuery('DataQueryTest_F');
|
||||||
@ -227,7 +227,7 @@ class DataQueryTest extends SapphireTest {
|
|||||||
$this->assertGreaterThan(0, $query->count(), "Couldn't find MyDate");
|
$this->assertGreaterThan(0, $query->count(), "Couldn't find MyDate");
|
||||||
$this->resetDBSchema(true);
|
$this->resetDBSchema(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testComparisonClauseTextCaseInsensitive() {
|
public function testComparisonClauseTextCaseInsensitive() {
|
||||||
DB::query("INSERT INTO \"DataQueryTest_F\" (\"MyString\") VALUES ('HelloWorld')");
|
DB::query("INSERT INTO \"DataQueryTest_F\" (\"MyString\") VALUES ('HelloWorld')");
|
||||||
$query = new DataQuery('DataQueryTest_F');
|
$query = new DataQuery('DataQueryTest_F');
|
||||||
@ -235,13 +235,13 @@ class DataQueryTest extends SapphireTest {
|
|||||||
$this->assertGreaterThan(0, $query->count(), "Couldn't find MyString");
|
$this->assertGreaterThan(0, $query->count(), "Couldn't find MyString");
|
||||||
$this->resetDBSchema(true);
|
$this->resetDBSchema(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testComparisonClauseTextCaseSensitive() {
|
public function testComparisonClauseTextCaseSensitive() {
|
||||||
DB::query("INSERT INTO \"DataQueryTest_F\" (\"MyString\") VALUES ('HelloWorld')");
|
DB::query("INSERT INTO \"DataQueryTest_F\" (\"MyString\") VALUES ('HelloWorld')");
|
||||||
$query = new DataQuery('DataQueryTest_F');
|
$query = new DataQuery('DataQueryTest_F');
|
||||||
$query->where(DB::getConn()->comparisonClause('"MyString"', 'HelloWorld', false, false, true));
|
$query->where(DB::getConn()->comparisonClause('"MyString"', 'HelloWorld', false, false, true));
|
||||||
$this->assertGreaterThan(0, $query->count(), "Couldn't find MyString");
|
$this->assertGreaterThan(0, $query->count(), "Couldn't find MyString");
|
||||||
|
|
||||||
$query2 = new DataQuery('DataQueryTest_F');
|
$query2 = new DataQuery('DataQueryTest_F');
|
||||||
$query2->where(DB::getConn()->comparisonClause('"MyString"', 'helloworld', false, false, true));
|
$query2->where(DB::getConn()->comparisonClause('"MyString"', 'helloworld', false, false, true));
|
||||||
$this->assertEquals(0, $query2->count(), "Found mystring. Shouldn't be able too.");
|
$this->assertEquals(0, $query2->count(), "Found mystring. Shouldn't be able too.");
|
||||||
|
@ -164,7 +164,7 @@ class DateTest extends SapphireTest {
|
|||||||
SS_Datetime::set_mock_now('2000-12-31 12:00:00');
|
SS_Datetime::set_mock_now('2000-12-31 12:00:00');
|
||||||
|
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
'1 month ago',
|
'1 month ago',
|
||||||
DBField::create_field('Date', '2000-11-26')->Ago(true, 1),
|
DBField::create_field('Date', '2000-11-26')->Ago(true, 1),
|
||||||
'Past match on days, less than two months, lowest significance'
|
'Past match on days, less than two months, lowest significance'
|
||||||
);
|
);
|
||||||
@ -176,7 +176,7 @@ class DateTest extends SapphireTest {
|
|||||||
);
|
);
|
||||||
|
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
'2 months ago',
|
'2 months ago',
|
||||||
DBField::create_field('Date', '2000-10-27')->Ago(),
|
DBField::create_field('Date', '2000-10-27')->Ago(),
|
||||||
'Past match on days, over two months'
|
'Past match on days, over two months'
|
||||||
);
|
);
|
||||||
@ -188,7 +188,7 @@ class DateTest extends SapphireTest {
|
|||||||
);
|
);
|
||||||
|
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
'10 years ago',
|
'10 years ago',
|
||||||
DBField::create_field('Date', '1990-12-31')->Ago(),
|
DBField::create_field('Date', '1990-12-31')->Ago(),
|
||||||
'Exact past match on years'
|
'Exact past match on years'
|
||||||
);
|
);
|
||||||
@ -200,13 +200,13 @@ class DateTest extends SapphireTest {
|
|||||||
);
|
);
|
||||||
|
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
'1 year ago',
|
'1 year ago',
|
||||||
DBField::create_field('Date', '1999-12-30')->Ago(true, 1),
|
DBField::create_field('Date', '1999-12-30')->Ago(true, 1),
|
||||||
'Approximate past match in singular, lowest significance'
|
'Approximate past match in singular, lowest significance'
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
'12 months ago',
|
'12 months ago',
|
||||||
DBField::create_field('Date', '1999-12-30')->Ago(),
|
DBField::create_field('Date', '1999-12-30')->Ago(),
|
||||||
'Approximate past match in singular'
|
'Approximate past match in singular'
|
||||||
);
|
);
|
||||||
@ -224,13 +224,13 @@ class DateTest extends SapphireTest {
|
|||||||
);
|
);
|
||||||
|
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
'in 1 day',
|
'in 1 day',
|
||||||
DBField::create_field('Date', '2001-01-01')->Ago(true, 1),
|
DBField::create_field('Date', '2001-01-01')->Ago(true, 1),
|
||||||
'Approximate past match on minutes'
|
'Approximate past match on minutes'
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
'in 24 hours',
|
'in 24 hours',
|
||||||
DBField::create_field('Date', '2001-01-01')->Ago(),
|
DBField::create_field('Date', '2001-01-01')->Ago(),
|
||||||
'Approximate past match on minutes'
|
'Approximate past match on minutes'
|
||||||
);
|
);
|
||||||
|
@ -105,13 +105,13 @@ class SS_DatetimeTest extends SapphireTest {
|
|||||||
);
|
);
|
||||||
|
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
'1 year ago',
|
'1 year ago',
|
||||||
DBField::create_field('SS_Datetime', '1999-12-30 12:00:12')->Ago(true, 1),
|
DBField::create_field('SS_Datetime', '1999-12-30 12:00:12')->Ago(true, 1),
|
||||||
'Approximate past match in singular, significance=1'
|
'Approximate past match in singular, significance=1'
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
'12 months ago',
|
'12 months ago',
|
||||||
DBField::create_field('SS_Datetime', '1999-12-30 12:00:12')->Ago(),
|
DBField::create_field('SS_Datetime', '1999-12-30 12:00:12')->Ago(),
|
||||||
'Approximate past match in singular'
|
'Approximate past match in singular'
|
||||||
);
|
);
|
||||||
@ -133,13 +133,13 @@ class SS_DatetimeTest extends SapphireTest {
|
|||||||
DBField::create_field('SS_Datetime', '2000-12-31 11:59:01')->Ago(false),
|
DBField::create_field('SS_Datetime', '2000-12-31 11:59:01')->Ago(false),
|
||||||
'Approximate past match on seconds with $includeSeconds=false'
|
'Approximate past match on seconds with $includeSeconds=false'
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
'1 min ago',
|
'1 min ago',
|
||||||
DBField::create_field('SS_Datetime', '2000-12-31 11:58:50')->Ago(false),
|
DBField::create_field('SS_Datetime', '2000-12-31 11:58:50')->Ago(false),
|
||||||
'Test between 1 and 2 minutes with includeSeconds=false'
|
'Test between 1 and 2 minutes with includeSeconds=false'
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
'70 secs ago',
|
'70 secs ago',
|
||||||
DBField::create_field('SS_Datetime', '2000-12-31 11:58:50')->Ago(true),
|
DBField::create_field('SS_Datetime', '2000-12-31 11:58:50')->Ago(true),
|
||||||
@ -147,19 +147,19 @@ class SS_DatetimeTest extends SapphireTest {
|
|||||||
);
|
);
|
||||||
|
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
'4 mins ago',
|
'4 mins ago',
|
||||||
DBField::create_field('SS_Datetime', '2000-12-31 11:55:50')->Ago(),
|
DBField::create_field('SS_Datetime', '2000-12-31 11:55:50')->Ago(),
|
||||||
'Past match on minutes'
|
'Past match on minutes'
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
'1 hour ago',
|
'1 hour ago',
|
||||||
DBField::create_field('SS_Datetime', '2000-12-31 10:50:58')->Ago(true, 1),
|
DBField::create_field('SS_Datetime', '2000-12-31 10:50:58')->Ago(true, 1),
|
||||||
'Past match on hours, significance=1'
|
'Past match on hours, significance=1'
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
'3 hours ago',
|
'3 hours ago',
|
||||||
DBField::create_field('SS_Datetime', '2000-12-31 08:50:58')->Ago(),
|
DBField::create_field('SS_Datetime', '2000-12-31 08:50:58')->Ago(),
|
||||||
'Past match on hours'
|
'Past match on hours'
|
||||||
);
|
);
|
||||||
@ -177,13 +177,13 @@ class SS_DatetimeTest extends SapphireTest {
|
|||||||
);
|
);
|
||||||
|
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
'in 1 hour',
|
'in 1 hour',
|
||||||
DBField::create_field('SS_Datetime', '2000-12-31 1:01:05')->Ago(true, 1),
|
DBField::create_field('SS_Datetime', '2000-12-31 1:01:05')->Ago(true, 1),
|
||||||
'Approximate past match on minutes, significance=1'
|
'Approximate past match on minutes, significance=1'
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
'in 61 mins',
|
'in 61 mins',
|
||||||
DBField::create_field('SS_Datetime', '2000-12-31 1:01:05')->Ago(),
|
DBField::create_field('SS_Datetime', '2000-12-31 1:01:05')->Ago(),
|
||||||
'Approximate past match on minutes'
|
'Approximate past match on minutes'
|
||||||
);
|
);
|
||||||
|
@ -245,7 +245,7 @@ class ImageTest extends SapphireTest {
|
|||||||
$this->assertTrue($fitMaxDn->isSize(100, 100));
|
$this->assertTrue($fitMaxDn->isSize(100, 100));
|
||||||
$fitMaxUp = $image->FitMax(500, 400);
|
$fitMaxUp = $image->FitMax(500, 400);
|
||||||
$this->assertTrue($fitMaxUp->isSize(300, 300));
|
$this->assertTrue($fitMaxUp->isSize(300, 300));
|
||||||
|
|
||||||
//Test ScaleMax
|
//Test ScaleMax
|
||||||
$scaleMaxWDn = $image->ScaleMaxWidth(200);
|
$scaleMaxWDn = $image->ScaleMaxWidth(200);
|
||||||
$this->assertTrue($scaleMaxWDn->isSize(200, 200));
|
$this->assertTrue($scaleMaxWDn->isSize(200, 200));
|
||||||
@ -261,7 +261,7 @@ class ImageTest extends SapphireTest {
|
|||||||
$this->assertTrue($cropMaxDn->isSize(200, 100));
|
$this->assertTrue($cropMaxDn->isSize(200, 100));
|
||||||
$cropMaxUp = $image->FillMax(400, 200);
|
$cropMaxUp = $image->FillMax(400, 200);
|
||||||
$this->assertTrue($cropMaxUp->isSize(300, 150));
|
$this->assertTrue($cropMaxUp->isSize(300, 150));
|
||||||
|
|
||||||
// Test Clip
|
// Test Clip
|
||||||
$clipWDn = $image->CropWidth(200);
|
$clipWDn = $image->CropWidth(200);
|
||||||
$this->assertTrue($clipWDn->isSize(200, 300));
|
$this->assertTrue($clipWDn->isSize(200, 300));
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
class MySQLDatabaseTest extends SapphireTest {
|
class MySQLDatabaseTest extends SapphireTest {
|
||||||
|
|
||||||
protected static $fixture_file = 'MySQLDatabaseTest.yml';
|
protected static $fixture_file = 'MySQLDatabaseTest.yml';
|
||||||
|
|
||||||
protected $extraDataObjects = array(
|
protected $extraDataObjects = array(
|
||||||
|
@ -31,7 +31,7 @@ class VersionedTest extends SapphireTest {
|
|||||||
'VersionedTest_WithIndexes_Live' =>
|
'VersionedTest_WithIndexes_Live' =>
|
||||||
array('value' => false, 'message' => 'Unique indexes are no longer unique in _Live table'),
|
array('value' => false, 'message' => 'Unique indexes are no longer unique in _Live table'),
|
||||||
);
|
);
|
||||||
|
|
||||||
// Test each table's performance
|
// Test each table's performance
|
||||||
foreach ($tableExpectations as $tableName => $expectation) {
|
foreach ($tableExpectations as $tableName => $expectation) {
|
||||||
$indexes = DB::get_schema()->indexList($tableName);
|
$indexes = DB::get_schema()->indexList($tableName);
|
||||||
|
Loading…
Reference in New Issue
Block a user