mirror of
https://github.com/silverstripe/silverstripe-frameworktest
synced 2024-10-22 11:06:02 +02:00
Merge pull request #29 from open-sausages/pulls/act-as
Fix dev/build with Member::actAs()
This commit is contained in:
commit
c56308861c
@ -11,10 +11,8 @@ use SilverStripe\Forms\FieldList;
|
|||||||
use SilverStripe\Forms\Form;
|
use SilverStripe\Forms\Form;
|
||||||
use SilverStripe\Forms\TextField;
|
use SilverStripe\Forms\TextField;
|
||||||
use SilverStripe\Control\Email\Email;
|
use SilverStripe\Control\Email\Email;
|
||||||
|
use SilverStripe\Security\Member;
|
||||||
|
use SilverStripe\Security\Security;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parent class of all test pages
|
* Parent class of all test pages
|
||||||
@ -40,6 +38,7 @@ class TestPage extends Page
|
|||||||
$class = $this->class;
|
$class = $this->class;
|
||||||
if (!DataObject::get_one($class)) {
|
if (!DataObject::get_one($class)) {
|
||||||
// Try to create common parent
|
// Try to create common parent
|
||||||
|
Member::actAs(Security::findAnAdministrator(), function () use ($class) {
|
||||||
$parent = SiteTree::get()
|
$parent = SiteTree::get()
|
||||||
->filter('URLSegment', 'feature-test-pages')
|
->filter('URLSegment', 'feature-test-pages')
|
||||||
->First();
|
->First();
|
||||||
@ -63,6 +62,7 @@ class TestPage extends Page
|
|||||||
}
|
}
|
||||||
$page->write();
|
$page->write();
|
||||||
$page->publish('Stage', 'Live');
|
$page->publish('Stage', 'Live');
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user