From 5282ad84f92dc37b0a9cec392c9682fd7a33ac47 Mon Sep 17 00:00:00 2001 From: Damian Mooyman Date: Mon, 23 Nov 2015 15:43:27 +1300 Subject: [PATCH] BUG Fix regression in #312 in PHP 5.3 --- code/model/BlogPost.php | 2 +- tests/BlogPostTest.php | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/code/model/BlogPost.php b/code/model/BlogPost.php index 7e98f2f..2eeb2a2 100644 --- a/code/model/BlogPost.php +++ b/code/model/BlogPost.php @@ -216,7 +216,7 @@ class BlogPost extends Page $authorField = ListboxField::create( 'Authors', _t('BlogPost.Authors', 'Authors'), - $this->getCandidateAuthors()->map()->toArray() + $self->getCandidateAuthors()->map()->toArray() )->setMultiple(true); $authorNames = TextField::create( diff --git a/tests/BlogPostTest.php b/tests/BlogPostTest.php index 6b10635..fd7b575 100644 --- a/tests/BlogPostTest.php +++ b/tests/BlogPostTest.php @@ -78,5 +78,9 @@ class BlogPostTest extends SapphireTest Config::inst()->update('BlogPost', 'restrict_authors_to_group', 'BlogUsers'); $this->assertEquals(3, $blogpost->getCandidateAuthors()->count()); + + // Test cms field is generated + $fields = $blogpost->getCMSFields(); + $this->assertNotEmpty($fields->dataFieldByName('Authors')); } }