Skip to content

Commit

Permalink
API Stop using deprecated API
Browse files Browse the repository at this point in the history
  • Loading branch information
emteknetnz committed Nov 2, 2022
1 parent 7a7c751 commit c0c2e74
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 15 deletions.
2 changes: 1 addition & 1 deletion tests/php/Controllers/CMSBatchActionsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ protected function setUp(): void
$this->logInWithPermission('ADMIN');

// Tests assume strict hierarchy is enabled
Config::inst()->update(SiteTree::class, 'enforce_strict_hierarchy', true);
Config::inst()->set(SiteTree::class, 'enforce_strict_hierarchy', true);

// published page
$published = $this->objFromFixture(SiteTree::class, 'published');
Expand Down
2 changes: 1 addition & 1 deletion tests/php/Model/RedirectorPageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ protected function setUp(): void
$file->publishSingle();
}

Director::config()->update('alternate_base_url', 'http://www.mysite.com/');
Director::config()->set('alternate_base_url', 'http://www.mysite.com/');

// Ensure all pages are published
/** @var Page $page */
Expand Down
18 changes: 9 additions & 9 deletions tests/php/Model/SiteTreeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ public function testRestoreToStage()

public function testNoCascadingDeleteWithoutID()
{
Config::inst()->update('SiteTree', 'enforce_strict_hierarchy', true);
Config::inst()->set('SiteTree', 'enforce_strict_hierarchy', true);
$count = SiteTree::get()->count();
$this->assertNotEmpty($count);
$obj = new SiteTree();
Expand Down Expand Up @@ -1253,27 +1253,27 @@ public function testAllowedChildrenValidation()
$classCext->write();

$classB->ParentID = $page->ID;
$valid = $classB->doValidate();
$valid = $classB->validate();
$this->assertTrue($valid->isValid(), "Does allow children on unrestricted parent");

$classB->ParentID = $classA->ID;
$valid = $classB->doValidate();
$valid = $classB->validate();
$this->assertTrue($valid->isValid(), "Does allow child specifically allowed by parent");

$classC->ParentID = $classA->ID;
$valid = $classC->doValidate();
$valid = $classC->validate();
$this->assertFalse($valid->isValid(), "Doesnt allow child on parents specifically restricting children");

$classB->ParentID = $classC->ID;
$valid = $classB->doValidate();
$valid = $classB->validate();
$this->assertFalse($valid->isValid(), "Doesnt allow child on parents disallowing all children");

$classB->ParentID = $classCext->ID;
$valid = $classB->doValidate();
$valid = $classB->validate();
$this->assertTrue($valid->isValid(), "Extensions of allowed classes are incorrectly reported as invalid");

$classCext->ParentID = $classD->ID;
$valid = $classCext->doValidate();
$valid = $classCext->validate();
$this->assertFalse($valid->isValid(), "Doesnt allow child where only parent class is allowed on parent node, and asterisk prefixing is used");
}

Expand Down Expand Up @@ -1655,7 +1655,7 @@ public function testGetControllerName()
*/
public function testGetControllerNameFromConfig()
{
Config::inst()->update(Page::class, 'controller_name', 'This\\Is\\A\\New\\Controller');
Config::inst()->set(Page::class, 'controller_name', 'This\\Is\\A\\New\\Controller');
$class = new Page;
$this->assertSame('This\\Is\\A\\New\\Controller', $class->getControllerName());
}
Expand All @@ -1665,7 +1665,7 @@ public function testGetControllerNameFromConfig()
*/
public function testGetControllerNameFromNamespaceMappingConfig()
{
Config::inst()->update(SiteTree::class, 'namespace_mapping', [
Config::inst()->merge(SiteTree::class, 'namespace_mapping', [
'SilverStripe\\CMS\\Tests\\Page' => 'SilverStripe\\CMS\\Tests\\Controllers',
]);

Expand Down
4 changes: 2 additions & 2 deletions tests/php/Model/VirtualPageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -412,11 +412,11 @@ public function testAllowedChildrenLimitedOnVirtualPages()
$classCVirtual->write();

$classBVirtual->ParentID = $classA->ID;
$valid = $classBVirtual->doValidate();
$valid = $classBVirtual->validate();
$this->assertTrue($valid->isValid(), "Does allow child linked to virtual page type allowed by parent");

$classCVirtual->ParentID = $classA->ID;
$valid = $classCVirtual->doValidate();
$valid = $classCVirtual->validate();
$this->assertFalse($valid->isValid(), "Doesn't allow child linked to virtual page type disallowed by parent");
}

Expand Down
2 changes: 0 additions & 2 deletions tests/php/Tasks/MigrateSiteTreeLinkingTaskTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ class MigrateSiteTreeLinkingTaskTest extends SapphireTest
{
protected static $fixture_file = 'MigrateSiteTreeLinkingTaskTest.yml';

protected static $use_draft_site = true;

public static function setUpBeforeClass(): void
{
parent::setUpBeforeClass();
Expand Down

0 comments on commit c0c2e74

Please sign in to comment.