mirror of
https://github.com/symbiote/silverstripe-gridfieldextensions.git
synced 2024-10-22 17:05:39 +02:00
FIX Update remaining unit tests, separate stubs, add PSR-4 autoloader
This commit is contained in:
parent
0ad1fc367e
commit
cb94bbe5e0
@ -42,7 +42,8 @@
|
|||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
"Symbiote\\GridFieldExtensions\\": "src/"
|
"Symbiote\\GridFieldExtensions\\": "src/",
|
||||||
|
"Symbiote\\GridFieldExtensions\\Tests\\": "tests/"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"prefer-stable": true,
|
"prefer-stable": true,
|
||||||
|
@ -1,9 +1,14 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
namespace Symbiote\GridFieldExtensions\Tests;
|
||||||
|
|
||||||
use SilverStripe\Dev\SapphireTest;
|
use SilverStripe\Dev\SapphireTest;
|
||||||
use SilverStripe\Dev\TestOnly;
|
use SilverStripe\Dev\TestOnly;
|
||||||
use SilverStripe\Forms\GridField\GridField;
|
use SilverStripe\Forms\GridField\GridField;
|
||||||
use Symbiote\GridFieldExtensions\GridFieldAddNewMultiClass;
|
use Symbiote\GridFieldExtensions\GridFieldAddNewMultiClass;
|
||||||
|
use Symbiote\GridFieldExtensions\Tests\Stub\StubA;
|
||||||
|
use Symbiote\GridFieldExtensions\Tests\Stub\StubB;
|
||||||
|
use Symbiote\GridFieldExtensions\Tests\Stub\StubC;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests for {@link GridFieldAddNewMultiClass}.
|
* Tests for {@link GridFieldAddNewMultiClass}.
|
||||||
@ -14,59 +19,32 @@ class GridFieldAddNewMultiClassTest extends SapphireTest
|
|||||||
public function testGetClasses()
|
public function testGetClasses()
|
||||||
{
|
{
|
||||||
$grid = new GridField('TestGridField');
|
$grid = new GridField('TestGridField');
|
||||||
$grid->setModelClass('GridFieldAddNewMultiClassTest_A');
|
$grid->setModelClass(StubA::class);
|
||||||
|
|
||||||
$component = new GridFieldAddNewMultiClass();
|
$component = new GridFieldAddNewMultiClass();
|
||||||
|
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
array(
|
array(
|
||||||
'GridFieldAddNewMultiClassTest_A' => 'A',
|
'Symbiote-GridFieldExtensions-Tests-Stub-StubA' => 'A',
|
||||||
'GridFieldAddNewMultiClassTest_B' => 'B',
|
'Symbiote-GridFieldExtensions-Tests-Stub-StubB' => 'B',
|
||||||
'GridFieldAddNewMultiClassTest_C' => 'C'
|
'Symbiote-GridFieldExtensions-Tests-Stub-StubC' => 'C'
|
||||||
),
|
),
|
||||||
$component->getClasses($grid),
|
$component->getClasses($grid),
|
||||||
'Subclasses are populated by default and sorted'
|
'Subclasses are populated by default and sorted'
|
||||||
);
|
);
|
||||||
|
|
||||||
$component->setClasses(array(
|
$component->setClasses(array(
|
||||||
'GridFieldAddNewMultiClassTest_B' => 'Custom Title',
|
StubB::class => 'Custom Title',
|
||||||
'GridFieldAddNewMultiClassTest_A'
|
StubA::class
|
||||||
));
|
));
|
||||||
|
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
array(
|
array(
|
||||||
'GridFieldAddNewMultiClassTest_B' => 'Custom Title',
|
'Symbiote-GridFieldExtensions-Tests-Stub-StubB' => 'Custom Title',
|
||||||
'GridFieldAddNewMultiClassTest_A' => 'A'
|
'Symbiote-GridFieldExtensions-Tests-Stub-StubA' => 'A'
|
||||||
),
|
),
|
||||||
$component->getClasses($grid),
|
$component->getClasses($grid),
|
||||||
'Sorting and custom titles can be specified'
|
'Sorting and custom titles can be specified'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**#@+
|
|
||||||
* @ignore
|
|
||||||
*/
|
|
||||||
|
|
||||||
class GridFieldAddNewMultiClassTest_A implements TestOnly
|
|
||||||
{
|
|
||||||
public function i18n_singular_name()
|
|
||||||
{
|
|
||||||
$class = get_class($this);
|
|
||||||
return substr($class, strpos($class, '_') + 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function canCreate()
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class GridFieldAddNewMultiClassTest_B extends GridFieldAddNewMultiClassTest_A implements TestOnly
|
|
||||||
{
|
|
||||||
}
|
|
||||||
class GridFieldAddNewMultiClassTest_C extends GridFieldAddNewMultiClassTest_A implements TestOnly
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**#@-*/
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Symbiote\Test;
|
namespace Symbiote\GridFieldExtensions\Tests;
|
||||||
|
|
||||||
use SilverStripe\Control\Controller;
|
use SilverStripe\Control\Controller;
|
||||||
use SilverStripe\Control\HTTPRequest;
|
use SilverStripe\Control\HTTPRequest;
|
||||||
@ -12,6 +12,7 @@ use SilverStripe\Forms\GridField\GridField;
|
|||||||
use SilverStripe\Forms\GridField\GridFieldDetailForm;
|
use SilverStripe\Forms\GridField\GridFieldDetailForm;
|
||||||
use Symbiote\GridFieldExtensions\GridFieldAddNewMultiClass;
|
use Symbiote\GridFieldExtensions\GridFieldAddNewMultiClass;
|
||||||
use Symbiote\GridFieldExtensions\GridFieldAddNewMultiClassHandler;
|
use Symbiote\GridFieldExtensions\GridFieldAddNewMultiClassHandler;
|
||||||
|
use Symbiote\GridFieldExtensions\Tests\Stub\NamespacedClass;
|
||||||
|
|
||||||
class GridFieldAddNewMultiClassWithNamespacesTest extends SapphireTest
|
class GridFieldAddNewMultiClassWithNamespacesTest extends SapphireTest
|
||||||
{
|
{
|
||||||
@ -19,13 +20,13 @@ class GridFieldAddNewMultiClassWithNamespacesTest extends SapphireTest
|
|||||||
public function testGetClassesWithNamespaces()
|
public function testGetClassesWithNamespaces()
|
||||||
{
|
{
|
||||||
$grid = new GridField('TestGridField');
|
$grid = new GridField('TestGridField');
|
||||||
$grid->setModelClass('Symbiote\\Test\\NamespacedClass');
|
$grid->setModelClass(NamespacedClass::class);
|
||||||
|
|
||||||
$component = new GridFieldAddNewMultiClass();
|
$component = new GridFieldAddNewMultiClass();
|
||||||
|
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
array(
|
array(
|
||||||
'Symbiote-Test-NamespacedClass' => 'NamespacedClass'
|
'Symbiote-GridFieldExtensions-Tests-Stub-NamespacedClass' => 'NamespacedClass'
|
||||||
),
|
),
|
||||||
$component->getClasses($grid),
|
$component->getClasses($grid),
|
||||||
'Namespaced classes are sanitised'
|
'Namespaced classes are sanitised'
|
||||||
@ -36,36 +37,17 @@ class GridFieldAddNewMultiClassWithNamespacesTest extends SapphireTest
|
|||||||
{
|
{
|
||||||
$grid = new GridField('TestGridField');
|
$grid = new GridField('TestGridField');
|
||||||
$grid->getConfig()->addComponent(new GridFieldDetailForm());
|
$grid->getConfig()->addComponent(new GridFieldDetailForm());
|
||||||
$grid->setModelClass('Symbiote\\Test\\NamespacedClass');
|
$grid->setModelClass(NamespacedClass::class);
|
||||||
$grid->setForm(Form::create(Controller::create(), 'test', FieldList::create(), FieldList::create()));
|
$grid->setForm(Form::create(Controller::create(), 'test', FieldList::create(), FieldList::create()));
|
||||||
|
|
||||||
$request = new HTTPRequest('POST', 'test');
|
$request = new HTTPRequest('POST', 'test');
|
||||||
$request->setRouteParams(array('ClassName' => 'Symbiote-Test-NamespacedClass'));
|
$request->setRouteParams(array('ClassName' => 'Symbiote-GridFieldExtensions-Tests-Stub-NamespacedClass'));
|
||||||
|
|
||||||
$component = new GridFieldAddNewMultiClass();
|
$component = new GridFieldAddNewMultiClass();
|
||||||
$response = $component->handleAdd($grid, $request);
|
$response = $component->handleAdd($grid, $request);
|
||||||
|
|
||||||
$record = new \ReflectionProperty(GridFieldAddNewMultiClassHandler::class, 'record');
|
$record = new \ReflectionProperty(GridFieldAddNewMultiClassHandler::class, 'record');
|
||||||
$record->setAccessible(true);
|
$record->setAccessible(true);
|
||||||
$this->assertInstanceOf('Symbiote\\Test\\NamespacedClass', $record->getValue($response));
|
$this->assertInstanceOf(NamespacedClass::class, $record->getValue($response));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**#@+
|
|
||||||
* @ignore
|
|
||||||
*/
|
|
||||||
|
|
||||||
class NamespacedClass implements TestOnly
|
|
||||||
{
|
|
||||||
public function i18n_singular_name()
|
|
||||||
{
|
|
||||||
return 'NamespacedClass';
|
|
||||||
}
|
|
||||||
|
|
||||||
public function canCreate()
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**#@-*/
|
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
namespace Symbiote\GridFieldExtensions\Tests;
|
||||||
|
|
||||||
use SilverStripe\Core\Config\Config;
|
use SilverStripe\Core\Config\Config;
|
||||||
use SilverStripe\Dev\SapphireTest;
|
use SilverStripe\Dev\SapphireTest;
|
||||||
use SilverStripe\Forms\GridField\GridField;
|
use SilverStripe\Forms\GridField\GridField;
|
||||||
|
@ -1,11 +1,15 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
namespace Symbiote\GridFieldExtensions\Tests;
|
||||||
|
|
||||||
|
use ReflectionMethod;
|
||||||
use SilverStripe\Dev\SapphireTest;
|
use SilverStripe\Dev\SapphireTest;
|
||||||
use SilverStripe\Dev\TestOnly;
|
|
||||||
use SilverStripe\Forms\GridField\GridField;
|
use SilverStripe\Forms\GridField\GridField;
|
||||||
use SilverStripe\Forms\GridField\GridFieldConfig_RelationEditor;
|
use SilverStripe\Forms\GridField\GridFieldConfig_RelationEditor;
|
||||||
use Symbiote\GridFieldExtensions\GridFieldOrderableRows;
|
use Symbiote\GridFieldExtensions\GridFieldOrderableRows;
|
||||||
use SilverStripe\ORM\DataObject;
|
use Symbiote\GridFieldExtensions\Tests\Stub\StubOrdered;
|
||||||
|
use Symbiote\GridFieldExtensions\Tests\Stub\StubParent;
|
||||||
|
use Symbiote\GridFieldExtensions\Tests\Stub\StubSubclass;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests for the {@link GridFieldOrderableRows} component.
|
* Tests for the {@link GridFieldOrderableRows} component.
|
||||||
@ -15,27 +19,21 @@ class GridFieldOrderableRowsTest extends SapphireTest
|
|||||||
|
|
||||||
protected $usesDatabase = true;
|
protected $usesDatabase = true;
|
||||||
|
|
||||||
// protected static $fixture_file = 'GridFieldOrderableRowsTest.yml';
|
protected static $fixture_file = 'GridFieldOrderableRowsTest.yml';
|
||||||
|
|
||||||
protected $extraDataObjects = array(
|
protected static $extra_dataobjects = array(
|
||||||
'GridFieldOrderableRowsTest_Parent',
|
StubParent::class,
|
||||||
'GridFieldOrderableRowsTest_Ordered',
|
StubOrdered::class,
|
||||||
'GridFieldOrderableRowsTest_Subclass',
|
StubSubclass::class,
|
||||||
);
|
);
|
||||||
|
|
||||||
public function setUp()
|
|
||||||
{
|
|
||||||
parent::setUp();
|
|
||||||
$this->markTestSkipped('Upgrade to 4.0: Needs to be re-implemented.');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testReorderItems()
|
public function testReorderItems()
|
||||||
{
|
{
|
||||||
$orderable = new GridFieldOrderableRows('ManyManySort');
|
$orderable = new GridFieldOrderableRows('ManyManySort');
|
||||||
$reflection = new ReflectionMethod($orderable, 'executeReorder');
|
$reflection = new ReflectionMethod($orderable, 'executeReorder');
|
||||||
$reflection->setAccessible(true);
|
$reflection->setAccessible(true);
|
||||||
|
|
||||||
$parent = $this->objFromFixture('GridFieldOrderableRowsTest_Parent', 'parent');
|
$parent = $this->objFromFixture(StubParent::class, 'parent');
|
||||||
|
|
||||||
$config = new GridFieldConfig_RelationEditor();
|
$config = new GridFieldConfig_RelationEditor();
|
||||||
$config->addComponent($orderable);
|
$config->addComponent($orderable);
|
||||||
@ -71,70 +69,27 @@ class GridFieldOrderableRowsTest extends SapphireTest
|
|||||||
{
|
{
|
||||||
$orderable = new GridFieldOrderableRows();
|
$orderable = new GridFieldOrderableRows();
|
||||||
|
|
||||||
$parent = new GridFieldOrderableRowsTest_Parent();
|
$parent = new StubParent();
|
||||||
$parent->write();
|
$parent->write();
|
||||||
|
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
'GridFieldOrderableRowsTest_Ordered',
|
'StubOrdered',
|
||||||
$orderable->getSortTable($parent->MyHasMany())
|
$orderable->getSortTable($parent->MyHasMany())
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
'GridFieldOrderableRowsTest_Ordered',
|
'StubOrdered',
|
||||||
$orderable->getSortTable($parent->MyHasManySubclass())
|
$orderable->getSortTable($parent->MyHasManySubclass())
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
'GridFieldOrderableRowsTest_Ordered',
|
'StubOrdered',
|
||||||
$orderable->getSortTable($parent->MyManyMany())
|
$orderable->getSortTable($parent->MyManyMany())
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
'GridFieldOrderableRowsTest_Parent_MyManyMany',
|
'StubParent_MyManyMany',
|
||||||
$orderable->setSortField('ManyManySort')->getSortTable($parent->MyManyMany())
|
$orderable->setSortField('ManyManySort')->getSortTable($parent->MyManyMany())
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**#@+
|
|
||||||
* @ignore
|
|
||||||
*/
|
|
||||||
|
|
||||||
class GridFieldOrderableRowsTest_Parent extends DataObject implements TestOnly
|
|
||||||
{
|
|
||||||
|
|
||||||
private static $has_many = array(
|
|
||||||
'MyHasMany' => 'GridFieldOrderableRowsTest_Ordered',
|
|
||||||
'MyHasManySubclass' => 'GridFieldOrderableRowsTest_Subclass'
|
|
||||||
);
|
|
||||||
|
|
||||||
private static $many_many = array(
|
|
||||||
'MyManyMany' => 'GridFieldOrderableRowsTest_Ordered'
|
|
||||||
);
|
|
||||||
|
|
||||||
private static $many_many_extraFields = array(
|
|
||||||
'MyManyMany' => array('ManyManySort' => 'Int')
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
class GridFieldOrderableRowsTest_Ordered extends DataObject implements TestOnly
|
|
||||||
{
|
|
||||||
|
|
||||||
private static $db = array(
|
|
||||||
'Sort' => 'Int'
|
|
||||||
);
|
|
||||||
|
|
||||||
private static $has_one = array(
|
|
||||||
'Parent' => 'GridFieldOrderableRowsTest_Parent'
|
|
||||||
);
|
|
||||||
|
|
||||||
private static $belongs_many_many =array(
|
|
||||||
'MyManyMany' => 'GridFieldOrderableRowsTest_Parent',
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
class GridFieldOrderableRowsTest_Subclass extends GridFieldOrderableRowsTest_Ordered implements TestOnly
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**#@-*/
|
|
||||||
|
@ -1,22 +1,29 @@
|
|||||||
GridFieldOrderableRowsTest_Ordered:
|
Symbiote\GridFieldExtensions\Tests\Stub\StubOrdered:
|
||||||
item1:
|
item1:
|
||||||
|
Sort: 1
|
||||||
item2:
|
item2:
|
||||||
|
Sort: 2
|
||||||
item3:
|
item3:
|
||||||
|
Sort: 3
|
||||||
item4:
|
item4:
|
||||||
|
Sort: 4
|
||||||
item5:
|
item5:
|
||||||
|
Sort: 5
|
||||||
item6:
|
item6:
|
||||||
GridFieldOrderableRowsTest_Parent:
|
Sort: 6
|
||||||
|
|
||||||
|
Symbiote\GridFieldExtensions\Tests\Stub\StubParent:
|
||||||
parent:
|
parent:
|
||||||
MyManyMany:
|
MyManyMany:
|
||||||
- 0: =>GridFieldOrderableRowsTest_Ordered.item1
|
- =>Symbiote\GridFieldExtensions\Tests\Stub\StubOrdered.item1:
|
||||||
ManyManySort: 1
|
ManyManySort: 1
|
||||||
- 1: =>GridFieldOrderableRowsTest_Ordered.item2
|
- =>Symbiote\GridFieldExtensions\Tests\Stub\StubOrdered.item2:
|
||||||
ManyManySort: 1
|
ManyManySort: 1
|
||||||
- 2: =>GridFieldOrderableRowsTest_Ordered.item3
|
- =>Symbiote\GridFieldExtensions\Tests\Stub\StubOrdered.item3:
|
||||||
ManyManySort: 2
|
ManyManySort: 2
|
||||||
- 3: =>GridFieldOrderableRowsTest_Ordered.item4
|
- =>Symbiote\GridFieldExtensions\Tests\Stub\StubOrdered.item4:
|
||||||
ManyManySort: 2
|
ManyManySort: 2
|
||||||
- 4: =>GridFieldOrderableRowsTest_Ordered.item5
|
- =>Symbiote\GridFieldExtensions\Tests\Stub\StubOrdered.item5:
|
||||||
ManyManySort: 108
|
ManyManySort: 108
|
||||||
- 5: =>GridFieldOrderableRowsTest_Ordered.item6
|
- =>Symbiote\GridFieldExtensions\Tests\Stub\StubOrdered.item6:
|
||||||
ManyManySort: 108
|
ManyManySort: 108
|
||||||
|
18
tests/Stub/NamespacedClass.php
Normal file
18
tests/Stub/NamespacedClass.php
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Symbiote\GridFieldExtensions\Tests\Stub;
|
||||||
|
|
||||||
|
use Silverstripe\Dev\TestOnly;
|
||||||
|
|
||||||
|
class NamespacedClass implements TestOnly
|
||||||
|
{
|
||||||
|
public function i18n_singular_name()
|
||||||
|
{
|
||||||
|
return 'NamespacedClass';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function canCreate()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
19
tests/Stub/StubA.php
Normal file
19
tests/Stub/StubA.php
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Symbiote\GridFieldExtensions\Tests\Stub;
|
||||||
|
|
||||||
|
use SilverStripe\Dev\TestOnly;
|
||||||
|
|
||||||
|
class StubA implements TestOnly
|
||||||
|
{
|
||||||
|
public function i18n_singular_name()
|
||||||
|
{
|
||||||
|
$class = get_class($this);
|
||||||
|
return substr($class, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function canCreate()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
9
tests/Stub/StubB.php
Normal file
9
tests/Stub/StubB.php
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Symbiote\GridFieldExtensions\Tests\Stub;
|
||||||
|
|
||||||
|
use SilverStripe\Dev\TestOnly;
|
||||||
|
|
||||||
|
class StubB extends StubA implements TestOnly
|
||||||
|
{
|
||||||
|
}
|
9
tests/Stub/StubC.php
Normal file
9
tests/Stub/StubC.php
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Symbiote\GridFieldExtensions\Tests\Stub;
|
||||||
|
|
||||||
|
use SilverStripe\Dev\TestOnly;
|
||||||
|
|
||||||
|
class StubC extends StubA implements TestOnly
|
||||||
|
{
|
||||||
|
}
|
23
tests/Stub/StubOrdered.php
Normal file
23
tests/Stub/StubOrdered.php
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Symbiote\GridFieldExtensions\Tests\Stub;
|
||||||
|
|
||||||
|
use SilverStripe\Dev\TestOnly;
|
||||||
|
use SilverStripe\ORM\DataObject;
|
||||||
|
|
||||||
|
class StubOrdered extends DataObject implements TestOnly
|
||||||
|
{
|
||||||
|
private static $db = array(
|
||||||
|
'Sort' => 'Int'
|
||||||
|
);
|
||||||
|
|
||||||
|
private static $has_one = array(
|
||||||
|
'Parent' => StubParent::class
|
||||||
|
);
|
||||||
|
|
||||||
|
private static $belongs_many_many =array(
|
||||||
|
'MyManyMany' => StubParent::class,
|
||||||
|
);
|
||||||
|
|
||||||
|
private static $table_name = 'StubOrdered';
|
||||||
|
}
|
24
tests/Stub/StubParent.php
Normal file
24
tests/Stub/StubParent.php
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Symbiote\GridFieldExtensions\Tests\Stub;
|
||||||
|
|
||||||
|
use SilverStripe\Dev\TestOnly;
|
||||||
|
use SilverStripe\ORM\DataObject;
|
||||||
|
|
||||||
|
class StubParent extends DataObject implements TestOnly
|
||||||
|
{
|
||||||
|
private static $has_many = array(
|
||||||
|
'MyHasMany' => StubOrdered::class,
|
||||||
|
'MyHasManySubclass' => StubSubclass::class
|
||||||
|
);
|
||||||
|
|
||||||
|
private static $many_many = array(
|
||||||
|
'MyManyMany' => StubOrdered::class
|
||||||
|
);
|
||||||
|
|
||||||
|
private static $many_many_extraFields = array(
|
||||||
|
'MyManyMany' => array('ManyManySort' => 'Int')
|
||||||
|
);
|
||||||
|
|
||||||
|
private static $table_name = 'StubParent';
|
||||||
|
}
|
11
tests/Stub/StubSubclass.php
Normal file
11
tests/Stub/StubSubclass.php
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Symbiote\GridFieldExtensions\Tests\Stub;
|
||||||
|
|
||||||
|
use SilverStripe\Dev\TestOnly;
|
||||||
|
use SilverStripe\ORM\DataObject;
|
||||||
|
|
||||||
|
class StubSubclass extends StubOrdered implements TestOnly
|
||||||
|
{
|
||||||
|
private static $table_name = 'StubSubclass';
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user