Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

MINOR Fixed failing tests on pgsql

  • Loading branch information...
commit 6c9a3ba9f0ac97460cce8c9117ef7978d7865f00 1 parent 1742b4b
@halkyon halkyon authored
View
8 tests/forms/ListboxFieldTest.php
@@ -117,19 +117,19 @@ function testSaveIntoManyManyRelation() {
$field->setValue(array($tag1->ID,$tag2->ID));
$field->saveInto($article);
$article = Dataobject::get_by_id('ListboxFieldTest_Article', $article->ID, false);
- $this->assertEquals(array($tag1->ID, $tag2->ID), $article->Tags()->column('ID'));
+ $this->assertEquals(array($tag1->ID, $tag2->ID), $article->Tags()->sort('ID')->column('ID'));
// Remove existing relation
$field->setValue(array($tag1->ID));
$field->saveInto($article);
$article = Dataobject::get_by_id('ListboxFieldTest_Article', $article->ID, false);
- $this->assertEquals(array($tag1->ID), $article->Tags()->column('ID'));
+ $this->assertEquals(array($tag1->ID), $article->Tags()->sort('ID')->column('ID'));
// Set NULL value
$field->setValue(null);
$field->saveInto($article);
$article = Dataobject::get_by_id('ListboxFieldTest_Article', $article->ID, false);
- $this->assertEquals(array(), $article->Tags()->column('ID'));
+ $this->assertEquals(array(), $article->Tags()->sort('ID')->column('ID'));
}
/**
@@ -216,4 +216,4 @@ class ListboxFieldTest_Tag extends DataObject implements TestOnly {
static $belongs_many_many = array(
'Articles' => 'ListboxFieldTest_Article'
);
-}
+}
View
38 tests/forms/gridfield/GridFieldDetailFormTest.php
@@ -8,13 +8,13 @@ class GridFieldDetailFormTest extends FunctionalTest {
'GridFieldDetailFormTest_PeopleGroup',
'GridFieldDetailFormTest_Category',
);
-
function testAddForm() {
$this->logInWithPermission('ADMIN');
$group = DataList::create('GridFieldDetailFormTest_PeopleGroup')
- ->filter('Name', 'My Group')
- ->First();
+ ->filter('Name', 'My Group')
+ ->sort('Name')
+ ->First();
$count = $group->People()->Count();
$response = $this->get('GridFieldDetailFormTest_Controller');
@@ -41,16 +41,18 @@ function testAddForm() {
$this->assertFalse($response->isError());
$group = DataList::create('GridFieldDetailFormTest_PeopleGroup')
- ->filter('Name', 'My Group')
- ->First();
- $this->assertEquals($count + 1, $group->People()->Count());
+ ->filter('Name', 'My Group')
+ ->sort('Name')
+ ->First();
+ $this->assertEquals($count + 1, $group->People()->Count());
}
function testEditForm() {
$this->logInWithPermission('ADMIN');
$group = DataList::create('GridFieldDetailFormTest_PeopleGroup')
- ->filter('Name', 'My Group')
- ->First();
+ ->filter('Name', 'My Group')
+ ->sort('Name')
+ ->First();
$firstperson = $group->People()->First();
$this->assertTrue($firstperson->Surname != 'Baggins');
@@ -78,10 +80,11 @@ function testEditForm() {
$this->assertFalse($response->isError());
$group = DataList::create('GridFieldDetailFormTest_PeopleGroup')
- ->filter('Name', 'My Group')
- ->First();
- $firstperson = $group->People()->First();
- $this->assertEquals($firstperson->Surname, 'Baggins');
+ ->filter('Name', 'My Group')
+ ->sort('Name')
+ ->First();
+ $firstperson = $group->People()->First();
+ $this->assertEquals($firstperson->Surname, 'Baggins');
}
function testNestedEditForm() {
@@ -108,7 +111,7 @@ function testNestedEditForm() {
$parser = new CSSContentParser($response->getBody());
$personEditLink = $parser->getByXpath('//fieldset[@id="Form_ItemEditForm_People"]//tr[contains(@class, "ss-gridfield-item") and contains(@data-id, "' . $person->ID . '")]//a');
$this->assertEquals(
- 'GridFieldDetailFormTest_GroupController/Form/field/testfield/item/1/ItemEditForm/field/People/item/' . $person->ID . '/edit',
+ sprintf('GridFieldDetailFormTest_GroupController/Form/field/testfield/item/%d/ItemEditForm/field/People/item/%d/edit', $group->ID, $person->ID),
(string)$personEditLink[0]['href']
);
@@ -118,7 +121,7 @@ function testNestedEditForm() {
$parser = new CSSContentParser($response->getBody());
$categoryEditLink = $parser->getByXpath('//fieldset[@id="Form_ItemEditForm_Categories"]//tr[contains(@class, "ss-gridfield-item") and contains(@data-id, "' . $category->ID . '")]//a');
$this->assertEquals(
- 'GridFieldDetailFormTest_GroupController/Form/field/testfield/item/1/ItemEditForm/field/People/item/' . $category->ID . '/ItemEditForm/field/Categories/item/1/edit',
+ sprintf('GridFieldDetailFormTest_GroupController/Form/field/testfield/item/%d/ItemEditForm/field/People/item/%d/ItemEditForm/field/Categories/item/%d/edit', $group->ID, $person->ID, $category->ID),
(string)$categoryEditLink[0]['href']
);
@@ -202,8 +205,9 @@ class GridFieldDetailFormTest_Controller extends Controller implements TestOnly
function Form() {
$group = DataList::create('GridFieldDetailFormTest_PeopleGroup')
- ->filter('Name', 'My Group')
- ->First();
+ ->filter('Name', 'My Group')
+ ->sort('Name')
+ ->First();
$field = new GridField('testfield', 'testfield', $group->People());
$field->getConfig()->addComponent(new GridFieldToolbarHeader());
@@ -219,7 +223,7 @@ class GridFieldDetailFormTest_GroupController extends Controller implements Test
protected $template = 'BlankPage';
function Form() {
- $field = new GridField('testfield', 'testfield', DataList::create('GridFieldDetailFormTest_PeopleGroup'));
+ $field = new GridField('testfield', 'testfield', DataList::create('GridFieldDetailFormTest_PeopleGroup')->sort('Name'));
$field->getConfig()->addComponent($gridFieldForm = new GridFieldDetailForm($this, 'Form'));
$field->getConfig()->addComponent(new GridFieldToolbarHeader());
$field->getConfig()->addComponent(new GridFieldAddNewButton('toolbar-header-right'));
View
10 tests/model/ManyManyListTest.php
@@ -72,11 +72,11 @@ public function testSetByIdList() {
$team1 = $this->objFromFixture('DataObjectTest_Team', 'team1');
$team2 = $this->objFromFixture('DataObjectTest_Team', 'team2');
$player1->Teams()->setByIdList(array($team1->ID, $team2->ID));
- $this->assertEquals(array($team1->ID, $team2->ID), $player1->Teams()->column());
+ $this->assertEquals(array($team1->ID, $team2->ID), $player1->Teams()->sort('Title')->column());
$player1->Teams()->setByIdList(array($team1->ID));
- $this->assertEquals(array($team1->ID), $player1->Teams()->column());
+ $this->assertEquals(array($team1->ID), $player1->Teams()->sort('Title')->column());
$player1->Teams()->setByIdList(array($team2->ID));
- $this->assertEquals(array($team2->ID), $player1->Teams()->column());
+ $this->assertEquals(array($team2->ID), $player1->Teams()->sort('Title')->column());
}
public function testAddingWithMultipleForeignKeys() {
@@ -89,7 +89,7 @@ public function testAddingWithMultipleForeignKeys() {
$playersTeam1Team2->add($newPlayer);
$this->assertEquals(
array($team1->ID, $team2->ID),
- $newPlayer->Teams()->column('ID')
+ $newPlayer->Teams()->sort('Title')->column('ID')
);
}
@@ -115,4 +115,4 @@ public function testSubtractOnAManyManyList() {
$this->assertEquals(1,$teamsWithoutTheCaptain->count(), 'The ManyManyList should onlu contain one team');
$this->assertEquals($teamTwoID, $teamsWithoutTheCaptain->first()->ID, 'The ManyManyList contains the wrong team');
}
-}
+}
Please sign in to comment.
Something went wrong with that request. Please try again.