mirror of
https://github.com/silverstripe/silverstripe-comments
synced 2024-10-22 11:05:49 +02:00
FIX Comments GridField tests now use their own test stubs
This commit is contained in:
parent
4e23771d79
commit
c7235e1c5d
@ -8,13 +8,13 @@ use SilverStripe\Comments\Admin\CommentsGridFieldAction;
|
|||||||
use SilverStripe\Comments\Admin\CommentsGridFieldConfig;
|
use SilverStripe\Comments\Admin\CommentsGridFieldConfig;
|
||||||
use SilverStripe\Comments\Model\Comment;
|
use SilverStripe\Comments\Model\Comment;
|
||||||
use SilverStripe\Comments\Tests\Stubs\CommentableItem;
|
use SilverStripe\Comments\Tests\Stubs\CommentableItem;
|
||||||
|
use SilverStripe\Comments\Tests\Stubs\Team;
|
||||||
use SilverStripe\Control\Controller;
|
use SilverStripe\Control\Controller;
|
||||||
use SilverStripe\Dev\SapphireTest;
|
use SilverStripe\Dev\SapphireTest;
|
||||||
use SilverStripe\Forms\FieldList;
|
use SilverStripe\Forms\FieldList;
|
||||||
use SilverStripe\Forms\Form;
|
use SilverStripe\Forms\Form;
|
||||||
use SilverStripe\Forms\GridField\GridField;
|
use SilverStripe\Forms\GridField\GridField;
|
||||||
use SilverStripe\Forms\GridField\GridFieldDeleteAction;
|
use SilverStripe\Forms\GridField\GridFieldDeleteAction;
|
||||||
use SilverStripe\Forms\Tests\GridField\GridFieldTest\Team;
|
|
||||||
use SilverStripe\ORM\ArrayList;
|
use SilverStripe\ORM\ArrayList;
|
||||||
use SilverStripe\ORM\DataList;
|
use SilverStripe\ORM\DataList;
|
||||||
use SilverStripe\ORM\DataObject;
|
use SilverStripe\ORM\DataObject;
|
||||||
|
19
tests/Stubs/Cheerleader.php
Normal file
19
tests/Stubs/Cheerleader.php
Normal 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
24
tests/Stubs/Player.php
Normal 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
35
tests/Stubs/Team.php
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user