diff --git a/tests/GridFieldOrderableRowsTest.php b/tests/GridFieldOrderableRowsTest.php index 44e9f1b..7089e94 100644 --- a/tests/GridFieldOrderableRowsTest.php +++ b/tests/GridFieldOrderableRowsTest.php @@ -7,7 +7,6 @@ use SilverStripe\Forms\GridField\GridField; use SilverStripe\Forms\GridField\GridFieldConfig_RelationEditor; use Symbiote\GridFieldExtensions\GridFieldOrderableRows; -use Symbiote\GridFieldExtensions\Tests\Stub\PolymorphM2MChild; use Symbiote\GridFieldExtensions\Tests\Stub\PolymorphM2MMapper; use Symbiote\GridFieldExtensions\Tests\Stub\PolymorphM2MParent; use Symbiote\GridFieldExtensions\Tests\Stub\StubOrderableChild; @@ -17,9 +16,12 @@ use Symbiote\GridFieldExtensions\Tests\Stub\StubSubclass; use Symbiote\GridFieldExtensions\Tests\Stub\StubSubclassOrderedVersioned; use Symbiote\GridFieldExtensions\Tests\Stub\StubUnorderable; +use Symbiote\GridFieldExtensions\Tests\Stub\ThroughBelongs; +use Symbiote\GridFieldExtensions\Tests\Stub\ThroughBelongsVersioned; use Symbiote\GridFieldExtensions\Tests\Stub\ThroughDefiner; +use Symbiote\GridFieldExtensions\Tests\Stub\ThroughDefinerVersioned; use Symbiote\GridFieldExtensions\Tests\Stub\ThroughIntermediary; -use Symbiote\GridFieldExtensions\Tests\Stub\ThroughBelongs; +use Symbiote\GridFieldExtensions\Tests\Stub\ThroughIntermediaryVersioned; /** * Tests for the {@link GridFieldOrderableRows} component. @@ -46,13 +48,20 @@ class GridFieldOrderableRowsTest extends SapphireTest ThroughDefiner::class, ThroughIntermediary::class, ThroughBelongs::class, + ThroughDefinerVersioned::class, + ThroughIntermediaryVersioned::class, + ThroughBelongsVersioned::class, ]; public function reorderItemsProvider() { return [ + [StubParent::class . '.parent', 'MyHasMany', 'Sort'], + [StubParent::class . '.parent', 'MyHasManySubclass', 'Sort'], + [StubParent::class . '.parent-subclass-ordered-versioned', 'MyHasManySubclassOrderedVersioned', 'Sort'], [StubParent::class . '.parent', 'MyManyMany', 'ManyManySort'], [ThroughDefiner::class . '.DefinerOne', 'Belongings', 'Sort'], + [ThroughDefinerVersioned::class . '.DefinerOne', 'Belongings', 'Sort'], // [PolymorphM2MParent::class . '.ParentOne', 'Children', 'Sort'] ]; } diff --git a/tests/GridFieldOrderableRowsTest.yml b/tests/GridFieldOrderableRowsTest.yml index 8efc5ec..4b79b58 100644 --- a/tests/GridFieldOrderableRowsTest.yml +++ b/tests/GridFieldOrderableRowsTest.yml @@ -7,6 +7,7 @@ Symbiote\GridFieldExtensions\Tests\Stub\StubOrderableChild: Sort: 3 item4: Sort: 4 + Symbiote\GridFieldExtensions\Tests\Stub\StubOrdered: item1: Sort: 1 @@ -27,6 +28,20 @@ Symbiote\GridFieldExtensions\Tests\Stub\StubOrdered: - =>Symbiote\GridFieldExtensions\Tests\Stub\StubOrderableChild.item3 - =>Symbiote\GridFieldExtensions\Tests\Stub\StubOrderableChild.item4 +Symbiote\GridFieldExtensions\Tests\Stub\StubSubclass: + item1: + Sort: 1 + item2: + Sort: 2 + item3: + Sort: 3 + item4: + Sort: 4 + item5: + Sort: 5 + item6: + Sort: 6 + Symbiote\GridFieldExtensions\Tests\Stub\StubSubclassOrderedVersioned: item1: ExtraField: 1 @@ -56,6 +71,20 @@ Symbiote\GridFieldExtensions\Tests\Stub\StubParent: ManyManySort: 108 - =>Symbiote\GridFieldExtensions\Tests\Stub\StubOrdered.item6: ManyManySort: 108 + MyHasMany: + - =>Symbiote\GridFieldExtensions\Tests\Stub\StubOrdered.item1 + - =>Symbiote\GridFieldExtensions\Tests\Stub\StubOrdered.item2 + - =>Symbiote\GridFieldExtensions\Tests\Stub\StubOrdered.item3 + - =>Symbiote\GridFieldExtensions\Tests\Stub\StubOrdered.item4 + - =>Symbiote\GridFieldExtensions\Tests\Stub\StubOrdered.item5 + - =>Symbiote\GridFieldExtensions\Tests\Stub\StubOrdered.item6 + MyHasManySubclass: + - =>Symbiote\GridFieldExtensions\Tests\Stub\StubSubclass.item1 + - =>Symbiote\GridFieldExtensions\Tests\Stub\StubSubclass.item2 + - =>Symbiote\GridFieldExtensions\Tests\Stub\StubSubclass.item3 + - =>Symbiote\GridFieldExtensions\Tests\Stub\StubSubclass.item4 + - =>Symbiote\GridFieldExtensions\Tests\Stub\StubSubclass.item5 + - =>Symbiote\GridFieldExtensions\Tests\Stub\StubSubclass.item6 parent-subclass-ordered-versioned: MyHasManySubclassOrderedVersioned: - =>Symbiote\GridFieldExtensions\Tests\Stub\StubSubclassOrderedVersioned.item1 diff --git a/tests/OrderableRowsThroughTest.yml b/tests/OrderableRowsThroughTest.yml index a0e11ea..7052d4d 100644 --- a/tests/OrderableRowsThroughTest.yml +++ b/tests/OrderableRowsThroughTest.yml @@ -28,3 +28,34 @@ Symbiote\GridFieldExtensions\Tests\Stub\ThroughIntermediary: Defining: =>Symbiote\GridFieldExtensions\Tests\Stub\ThroughDefiner.DefinerTwo Belonging: =>Symbiote\GridFieldExtensions\Tests\Stub\ThroughBelongs.BelongsThree Sort: 2 + +Symbiote\GridFieldExtensions\Tests\Stub\ThroughDefinerVersioned: + DefinerOne: + DefinerTwo: + +Symbiote\GridFieldExtensions\Tests\Stub\ThroughBelongsVersioned: + BelongsOne: + BelongsTwo: + BelongsThree: + +Symbiote\GridFieldExtensions\Tests\Stub\ThroughIntermediaryVersioned: + One: + Defining: =>Symbiote\GridFieldExtensions\Tests\Stub\ThroughDefinerVersioned.DefinerOne + Belonging: =>Symbiote\GridFieldExtensions\Tests\Stub\ThroughBelongsVersioned.BelongsOne + Sort: 3 + Two: + Defining: =>Symbiote\GridFieldExtensions\Tests\Stub\ThroughDefinerVersioned.DefinerOne + Belonging: =>Symbiote\GridFieldExtensions\Tests\Stub\ThroughBelongsVersioned.BelongsTwo + Sort: 2 + Three: + Defining: =>Symbiote\GridFieldExtensions\Tests\Stub\ThroughDefinerVersioned.DefinerOne + Belonging: =>Symbiote\GridFieldExtensions\Tests\Stub\ThroughBelongsVersioned.BelongsThree + Sort: 1 + Four: + Defining: =>Symbiote\GridFieldExtensions\Tests\Stub\ThroughDefinerVersioned.DefinerTwo + Belonging: =>Symbiote\GridFieldExtensions\Tests\Stub\ThroughBelongsVersioned.BelongsTwo + Sort: 1 + Five: + Defining: =>Symbiote\GridFieldExtensions\Tests\Stub\ThroughDefinerVersioned.DefinerTwo + Belonging: =>Symbiote\GridFieldExtensions\Tests\Stub\ThroughBelongsVersioned.BelongsThree + Sort: 2 diff --git a/tests/Stub/ThroughBelongsVersioned.php b/tests/Stub/ThroughBelongsVersioned.php new file mode 100644 index 0000000..d6f695b --- /dev/null +++ b/tests/Stub/ThroughBelongsVersioned.php @@ -0,0 +1,25 @@ + ThroughDefinerVersioned::class, + ]; + + private static array $extensions = [ + Versioned::class, + ]; +} diff --git a/tests/Stub/ThroughDefinerVersioned.php b/tests/Stub/ThroughDefinerVersioned.php new file mode 100644 index 0000000..9cb6af2 --- /dev/null +++ b/tests/Stub/ThroughDefinerVersioned.php @@ -0,0 +1,33 @@ + [ + 'through' => ThroughIntermediaryVersioned::class, + 'from' => 'Defining', + 'to' => 'Belonging', + ] + ]; + + private static array $owns = [ + 'Belongings' + ]; + + private static array $extensions = [ + Versioned::class, + ]; +} diff --git a/tests/Stub/ThroughIntermediaryVersioned.php b/tests/Stub/ThroughIntermediaryVersioned.php new file mode 100644 index 0000000..5ad3f14 --- /dev/null +++ b/tests/Stub/ThroughIntermediaryVersioned.php @@ -0,0 +1,32 @@ + 'Int', + ]; + + private static array $has_one = [ + 'Defining' => ThroughDefinerVersioned::class, + 'Belonging' => ThroughBelongsVersioned::class, + ]; + + private static array $extensions = [ + Versioned::class, + ]; +}