API Stop using deprecated API

This commit is contained in:
Steve Boyd 2022-11-25 12:43:00 +13:00
parent c407dc0cc2
commit 6e020c663b
6 changed files with 8 additions and 24 deletions

View File

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

View File

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

View File

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

View File

@ -95,7 +95,7 @@ class BlogPostTest extends SapphireTest
$this->assertEquals(7, $blogpost->getCandidateAuthors()->count()); $this->assertEquals(7, $blogpost->getCandidateAuthors()->count());
//Set the group to draw Members from //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()); $this->assertEquals(3, $blogpost->getCandidateAuthors()->count());

View File

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

View File

@ -50,12 +50,12 @@ class BlogTest extends SapphireTest
*/ */
$blog = $this->objFromFixture(Blog::class, 'FirstBlog'); $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(); $classes = $blog->getExcludedSiteTreeClassNames();
$this->assertNotContains(BlogPost::class, $classes, 'BlogPost class should be hidden.'); $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(); $classes = $blog->getExcludedSiteTreeClassNames();
$this->assertContains(BlogPost::class, $classes, 'BlogPost class should be hidden.'); $this->assertContains(BlogPost::class, $classes, 'BlogPost class should be hidden.');