Merge pull request #691 from creative-commoners/pulls/3/stop-using-depr

API Stop using deprecated API
This commit is contained in:
Sabina Talipova 2022-12-05 16:38:39 +13:00 committed by GitHub
commit 4a51782360
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 8 additions and 24 deletions

View File

@ -16,7 +16,7 @@ class BlogCommentExtension extends DataExtension
*/
public function getExtraClass()
{
$blogPost = $this->owner->getParent();
$blogPost = $this->owner->Parent();
if ($blogPost instanceof BlogPost) {
if ($blogPost->isAuthor($this->owner->Author())) {

View File

@ -2,14 +2,14 @@
<% if $Categories.exists %>
<%t SilverStripe\\Blog\\Model\\Blog.PostedIn "Posted in" %>
<% loop $Categories %>
<a href="$Link" title="$Title">$Title</a><% if not Last %>, <% else %>;<% end_if %>
<a href="$Link" title="$Title">$Title</a><% if not $IsLast %>, <% else %>;<% end_if %>
<% end_loop %>
<% end_if %>
<% if $Tags.exists %>
<%t SilverStripe\\Blog\\Model\\Blog.Tagged "Tagged" %>
<% loop $Tags %>
<a href="$Link" title="$Title">$Title</a><% if not Last %>, <% else %>;<% end_if %>
<a href="$Link" title="$Title">$Title</a><% if not $IsLast %>, <% else %>;<% end_if %>
<% end_loop %>
<% end_if %>
@ -27,8 +27,8 @@
<%t SilverStripe\\Blog\\Model\\Blog.By "by" %>
<% loop $Credits %>
<% if not $First && not $Last %>, <% end_if %>
<% if not $First && $Last %> <%t SilverStripe\\Blog\\Model\\Blog.AND "and" %> <% end_if %>
<% if not $IsFirst && not $IsLast %>, <% end_if %>
<% if not $IsFirst && $IsLast %> <%t SilverStripe\\Blog\\Model\\Blog.AND "and" %> <% end_if %>
<% if $URLSegment && not $Up.ProfilesDisabled %>
<a href="$URL">$Name.XML</a>
<% else %>

View File

@ -80,8 +80,6 @@ class BlogCategoryTest extends FunctionalTest
public function testCanView()
{
$this->useDraftSite();
$this->objFromFixture(Member::class, 'Admin');
$editor = $this->objFromFixture(Member::class, 'Editor');
@ -95,8 +93,6 @@ class BlogCategoryTest extends FunctionalTest
*/
public function testCanEdit()
{
$this->useDraftSite();
$admin = $this->objFromFixture(Member::class, 'Admin');
$editor = $this->objFromFixture(Member::class, 'Editor');
@ -118,8 +114,6 @@ class BlogCategoryTest extends FunctionalTest
public function testCanCreate()
{
$this->useDraftSite();
$admin = $this->objFromFixture(Member::class, 'Admin');
$editor = $this->objFromFixture(Member::class, 'Editor');
@ -131,8 +125,6 @@ class BlogCategoryTest extends FunctionalTest
public function testCanDelete()
{
$this->useDraftSite();
$admin = $this->objFromFixture(Member::class, 'Admin');
$editor = $this->objFromFixture(Member::class, 'Editor');

View File

@ -95,7 +95,7 @@ class BlogPostTest extends SapphireTest
$this->assertEquals(7, $blogpost->getCandidateAuthors()->count());
//Set the group to draw Members from
Config::inst()->update(BlogPost::class, 'restrict_authors_to_group', 'blogusers');
Config::inst()->set(BlogPost::class, 'restrict_authors_to_group', 'blogusers');
$this->assertEquals(3, $blogpost->getCandidateAuthors()->count());

View File

@ -73,8 +73,6 @@ class BlogTagTest extends FunctionalTest
*/
public function testCanView()
{
$this->useDraftSite();
$admin = $this->objFromFixture(Member::class, 'Admin');
$editor = $this->objFromFixture(Member::class, 'Editor');
@ -91,8 +89,6 @@ class BlogTagTest extends FunctionalTest
public function testCanEdit()
{
$this->useDraftSite();
$admin = $this->objFromFixture(Member::class, 'Admin');
$editor = $this->objFromFixture(Member::class, 'Editor');
@ -114,8 +110,6 @@ class BlogTagTest extends FunctionalTest
public function testCanCreate()
{
$this->useDraftSite();
$admin = $this->objFromFixture(Member::class, 'Admin');
$editor = $this->objFromFixture(Member::class, 'Editor');
@ -127,8 +121,6 @@ class BlogTagTest extends FunctionalTest
public function testCanDelete()
{
$this->useDraftSite();
$admin = $this->objFromFixture(Member::class, 'Admin');
$editor = $this->objFromFixture(Member::class, 'Editor');

View File

@ -50,12 +50,12 @@ class BlogTest extends SapphireTest
*/
$blog = $this->objFromFixture(Blog::class, 'FirstBlog');
Config::inst()->update(BlogPost::class, 'show_in_sitetree', true);
Config::inst()->set(BlogPost::class, 'show_in_sitetree', true);
$classes = $blog->getExcludedSiteTreeClassNames();
$this->assertNotContains(BlogPost::class, $classes, 'BlogPost class should be hidden.');
Config::inst()->update(BlogPost::class, 'show_in_sitetree', false);
Config::inst()->set(BlogPost::class, 'show_in_sitetree', false);
$classes = $blog->getExcludedSiteTreeClassNames();
$this->assertContains(BlogPost::class, $classes, 'BlogPost class should be hidden.');