From c7235e1c5d092e041b2956673fb2870665560184 Mon Sep 17 00:00:00 2001 From: Robbie Averill Date: Wed, 20 Jun 2018 16:53:14 +1200 Subject: [PATCH] FIX Comments GridField tests now use their own test stubs --- tests/CommentsGridFieldActionTest.php | 2 +- tests/Stubs/Cheerleader.php | 19 +++++++++++++++ tests/Stubs/Player.php | 24 ++++++++++++++++++ tests/Stubs/Team.php | 35 +++++++++++++++++++++++++++ 4 files changed, 79 insertions(+), 1 deletion(-) create mode 100644 tests/Stubs/Cheerleader.php create mode 100644 tests/Stubs/Player.php create mode 100644 tests/Stubs/Team.php diff --git a/tests/CommentsGridFieldActionTest.php b/tests/CommentsGridFieldActionTest.php index f3d8d9a..8558df2 100644 --- a/tests/CommentsGridFieldActionTest.php +++ b/tests/CommentsGridFieldActionTest.php @@ -8,13 +8,13 @@ use SilverStripe\Comments\Admin\CommentsGridFieldAction; use SilverStripe\Comments\Admin\CommentsGridFieldConfig; use SilverStripe\Comments\Model\Comment; use SilverStripe\Comments\Tests\Stubs\CommentableItem; +use SilverStripe\Comments\Tests\Stubs\Team; use SilverStripe\Control\Controller; use SilverStripe\Dev\SapphireTest; use SilverStripe\Forms\FieldList; use SilverStripe\Forms\Form; use SilverStripe\Forms\GridField\GridField; use SilverStripe\Forms\GridField\GridFieldDeleteAction; -use SilverStripe\Forms\Tests\GridField\GridFieldTest\Team; use SilverStripe\ORM\ArrayList; use SilverStripe\ORM\DataList; use SilverStripe\ORM\DataObject; diff --git a/tests/Stubs/Cheerleader.php b/tests/Stubs/Cheerleader.php new file mode 100644 index 0000000..25a5f87 --- /dev/null +++ b/tests/Stubs/Cheerleader.php @@ -0,0 +1,19 @@ + 'Varchar', + ]; + + private static $has_one = [ + 'Team' => Team::class, + ]; +} diff --git a/tests/Stubs/Player.php b/tests/Stubs/Player.php new file mode 100644 index 0000000..0720b30 --- /dev/null +++ b/tests/Stubs/Player.php @@ -0,0 +1,24 @@ + 'Varchar', + 'Email' => 'Varchar', + ); + + private static $belongs_many_many = [ + 'Teams' => Team::class, + ]; +} diff --git a/tests/Stubs/Team.php b/tests/Stubs/Team.php new file mode 100644 index 0000000..985dc60 --- /dev/null +++ b/tests/Stubs/Team.php @@ -0,0 +1,35 @@ + 'Varchar', + 'City' => 'Varchar', + ); + + private static $many_many = [ + 'Players' => Player::class, + ]; + + private static $has_many = [ + 'Cheerleaders' => Cheerleader::class, + ]; + + private static $searchable_fields = [ + 'Name', + 'City', + 'Cheerleaders.Name', + ]; + + public function canView($member = null) + { + return true; + } +}