mirror of
https://github.com/silverstripe/silverstripe-frameworktest
synced 2024-10-22 11:06:02 +02:00
New classes for testing ElementalArea in DataObject
This commit is contained in:
parent
da44d50d16
commit
94420d7373
@ -10,8 +10,13 @@ SilverStripe\Assets\File:
|
|||||||
|
|
||||||
---
|
---
|
||||||
Only:
|
Only:
|
||||||
classexists: 'DNADesign\Elemental\Extensions\ElementalPageExtension'
|
moduleexists: 'dnadesign/silverstripe-elemental'
|
||||||
---
|
---
|
||||||
SilverStripe\FrameworkTest\Model\TestPage:
|
SilverStripe\FrameworkTest\Model\TestPage:
|
||||||
extensions:
|
extensions:
|
||||||
- DNADesign\Elemental\Extensions\ElementalPageExtension
|
- DNADesign\Elemental\Extensions\ElementalPageExtension
|
||||||
|
|
||||||
|
SilverStripe\FrameworkTest\Elemental\Model\ElementalBehatTestObject:
|
||||||
|
extensions:
|
||||||
|
- DNADesign\Elemental\Extensions\ElementalAreasExtension
|
||||||
|
- SilverStripe\FrameworkTest\Elemental\Extension\ElementalBehatTestExtension
|
||||||
|
17
code/elemental/ElementalBehatTestAdmin.php
Normal file
17
code/elemental/ElementalBehatTestAdmin.php
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace SilverStripe\FrameworkTest\Elemental\Admin;
|
||||||
|
|
||||||
|
use SilverStripe\Admin\ModelAdmin;
|
||||||
|
use SilverStripe\FrameworkTest\Elemental\Model\ElementalBehatTestObject;
|
||||||
|
|
||||||
|
class ElementalBehatTestAdmin extends ModelAdmin
|
||||||
|
{
|
||||||
|
private static string $url_segment = 'elemental-behat-test-admin';
|
||||||
|
private static string $menu_title = 'Elemental Behat Test Admin';
|
||||||
|
private static string $menu_icon_class = 'font-icon-block-banner';
|
||||||
|
|
||||||
|
private static array $managed_models = [
|
||||||
|
ElementalBehatTestObject::class,
|
||||||
|
];
|
||||||
|
}
|
15
code/elemental/ElementalBehatTestExtension.php
Normal file
15
code/elemental/ElementalBehatTestExtension.php
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace SilverStripe\FrameworkTest\Elemental\Extension;
|
||||||
|
|
||||||
|
use DNADesign\Elemental\Models\ElementalArea;
|
||||||
|
use SilverStripe\ORM\DataExtension;
|
||||||
|
|
||||||
|
class ElementalBehatTestExtension extends DataExtension
|
||||||
|
{
|
||||||
|
private static $has_one = [
|
||||||
|
'ElementalArea' => ElementalArea::class,
|
||||||
|
];
|
||||||
|
|
||||||
|
private static $owns = ['ElementalArea'];
|
||||||
|
}
|
26
code/elemental/ElementalBehatTestObject.php
Normal file
26
code/elemental/ElementalBehatTestObject.php
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace SilverStripe\FrameworkTest\Elemental\Model;
|
||||||
|
|
||||||
|
use SilverStripe\FrameworkTest\Elemental\Admin\ElementalBehatTestAdmin;
|
||||||
|
use SilverStripe\Control\Controller;
|
||||||
|
use SilverStripe\ORM\DataObject;
|
||||||
|
|
||||||
|
class ElementalBehatTestObject extends DataObject
|
||||||
|
{
|
||||||
|
private static string $table_name = 'ElementalBehatTestObject';
|
||||||
|
|
||||||
|
public function CMSEditLink()
|
||||||
|
{
|
||||||
|
$admin = ElementalBehatTestAdmin::singleton();
|
||||||
|
$sanitisedClassname = str_replace('\\', '-', $this->ClassName);
|
||||||
|
|
||||||
|
return Controller::join_links(
|
||||||
|
$admin->Link($sanitisedClassname),
|
||||||
|
'EditForm/field/',
|
||||||
|
$sanitisedClassname,
|
||||||
|
'item',
|
||||||
|
$this->ID,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user