FIX Comments GridField tests now use their own test stubs

This commit is contained in:
Robbie Averill 2018-06-20 16:53:14 +12:00
parent 4e23771d79
commit c7235e1c5d
4 changed files with 79 additions and 1 deletions

View File

@ -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;

View File

@ -0,0 +1,19 @@
<?php
namespace SilverStripe\Comments\Tests\Stubs;
use SilverStripe\Dev\TestOnly;
use SilverStripe\ORM\DataObject;
class Cheerleader extends DataObject implements TestOnly
{
private static $table_name = 'CommentsTest_Cheerleader';
private static $db = [
'Name' => 'Varchar',
];
private static $has_one = [
'Team' => Team::class,
];
}

24
tests/Stubs/Player.php Normal file
View File

@ -0,0 +1,24 @@
<?php
namespace SilverStripe\Comments\Tests\Stubs;
use SilverStripe\Dev\TestOnly;
use SilverStripe\ORM\DataObject;
use SilverStripe\ORM\ManyManyList;
/**
* @method ManyManyList Teams()
*/
class Player extends DataObject implements TestOnly
{
private static $table_name = 'CommentsTest_Player';
private static $db = array(
'Name' => 'Varchar',
'Email' => 'Varchar',
);
private static $belongs_many_many = [
'Teams' => Team::class,
];
}

35
tests/Stubs/Team.php Normal file
View File

@ -0,0 +1,35 @@
<?php
namespace SilverStripe\Comments\Tests\Stubs;
use SilverStripe\Dev\TestOnly;
use SilverStripe\ORM\DataObject;
class Team extends DataObject implements TestOnly
{
private static $table_name = 'CommentsTest_Team';
private static $db = array(
'Name' => '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;
}
}