From 1cbf27e0f47c3547914b03193d0f5f77c87ff8d5 Mon Sep 17 00:00:00 2001 From: Robbie Averill Date: Tue, 29 May 2018 14:16:10 +1200 Subject: [PATCH 1/3] FIX PHP 5.3 compat for referencing $this in closure, and make method public for same reason sdf --- security/Member.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/security/Member.php b/security/Member.php index cd1d22518..ea06793df 100644 --- a/security/Member.php +++ b/security/Member.php @@ -1052,7 +1052,7 @@ class Member extends DataObject implements TemplateGlobalProvider { * * @return int[] List of group IDs */ - protected function disallowedGroups() { + public function disallowedGroups() { // unless the current user is an admin already OR the logged in user is an admin if (Permission::check('ADMIN') || Permission::checkMember($this, 'ADMIN')) { return array(); @@ -1476,7 +1476,7 @@ class Member extends DataObject implements TemplateGlobalProvider { if(Permission::check('EDIT_PERMISSIONS')) { // Filter allowed groups $groups = Group::get(); - $disallowedGroupIDs = $this->disallowedGroups(); + $disallowedGroupIDs = $self->disallowedGroups(); if ($disallowedGroupIDs) { $groups = $groups->exclude('ID', $disallowedGroupIDs); } From c1b0c56788a3ca230cbc76a2f38ee4300a678730 Mon Sep 17 00:00:00 2001 From: Robbie Averill Date: Sat, 2 Jun 2018 20:44:33 +1200 Subject: [PATCH 2/3] Increase memory limit to 2G in Travis builds --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 3cb849f4a..77a77322e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -34,6 +34,7 @@ before_script: - composer self-update || true - phpenv rehash - phpenv config-rm xdebug.ini + - echo 'memory_limit = 2G' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini - git clone git://github.com/silverstripe-labs/silverstripe-travis-support.git ~/travis-support - "if [ \"$BEHAT_TEST\" = \"\" ] && [ \"$CMS_TEST\" = \"\" ]; then php ~/travis-support/travis_setup.php --source `pwd` --target ~/builds/ss; fi" - "if [ \"$BEHAT_TEST\" = \"1\" ] && [ \"$CMS_TEST\" = \"\" ]; then php ~/travis-support/travis_setup.php --source `pwd` --target ~/builds/ss --require silverstripe/behat-extension; fi" From 41e601a036307065d9ea2ba8862f67be738d402f Mon Sep 17 00:00:00 2001 From: Daniel Hensby Date: Mon, 4 Jun 2018 15:17:05 +0100 Subject: [PATCH 3/3] FIX Regression from #8009 --- tests/model/DataObjectDuplicationTest.php | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/tests/model/DataObjectDuplicationTest.php b/tests/model/DataObjectDuplicationTest.php index 2fcab1c4d..7f73bf6a2 100644 --- a/tests/model/DataObjectDuplicationTest.php +++ b/tests/model/DataObjectDuplicationTest.php @@ -83,6 +83,13 @@ class DataObjectDuplicationTest extends SapphireTest { $two = DataObject::get_by_id("DataObjectDuplicateTestClass2", $two->ID); $three = DataObject::get_by_id("DataObjectDuplicateTestClass3", $three->ID); + $this->assertCount(1, $one->twos(), + "Many-to-one relation not copied (has_many)"); + $this->assertCount(1, $one->threes(), + "Object has the correct number of relations"); + $this->assertCount(1, $three->ones(), + "Object has the correct number of relations"); + //test duplication $oneCopy = $one->duplicate(); $twoCopy = $two->duplicate(); @@ -100,16 +107,16 @@ class DataObjectDuplicationTest extends SapphireTest { $this->assertEquals($text2, $twoCopy->text); $this->assertEquals($text3, $threeCopy->text); - $this->assertNotEquals($one->twos()->Count(), $oneCopy->twos()->Count(), + $this->assertCount(0, $oneCopy->twos(), "Many-to-one relation not copied (has_many)"); - $this->assertEquals($one->threes()->Count(), $oneCopy->threes()->Count(), + $this->assertCount(2, $oneCopy->threes(), "Object has the correct number of relations"); - $this->assertEquals($three->ones()->Count(), $threeCopy->ones()->Count(), + $this->assertCount(2, $threeCopy->ones(), "Object has the correct number of relations"); $this->assertEquals($one->ID, $twoCopy->one()->ID, "Match between relation of copy and the original"); - $this->assertEquals(0, $oneCopy->twos()->Count(), + $this->assertCount(0, $oneCopy->twos(), "Many-to-one relation not copied (has_many)"); $this->assertEquals($three->ID, $oneCopy->threes()->First()->ID, "Match between relation of copy and the original"); @@ -142,6 +149,8 @@ class DataObjectDuplicateTestClass1 extends DataObject implements TestOnly { 'TestExtra' => 'Varchar' ) ); + + private static $default_sort = '"ID" ASC'; } class DataObjectDuplicateTestClass2 extends DataObject implements TestOnly { @@ -154,6 +163,8 @@ class DataObjectDuplicateTestClass2 extends DataObject implements TestOnly { 'one' => 'DataObjectDuplicateTestClass1' ); + private static $default_sort = '"ID" ASC'; + } class DataObjectDuplicateTestClass3 extends DataObject implements TestOnly { @@ -165,6 +176,8 @@ class DataObjectDuplicateTestClass3 extends DataObject implements TestOnly { private static $belongs_many_many = array( 'ones' => 'DataObjectDuplicateTestClass1' ); + + private static $default_sort = '"ID" ASC'; }