Fixup test linting

This commit is contained in:
Damian Mooyman 2017-07-27 12:05:27 +12:00
parent 74873096bd
commit 47f24ce05b
No known key found for this signature in database
GPG Key ID: 78B823A10DE27D1A
2 changed files with 12 additions and 6 deletions

View File

@ -9,6 +9,7 @@ use SilverStripe\Forms\NumericField;
use SilverStripe\Forms\DropdownField; use SilverStripe\Forms\DropdownField;
use SilverStripe\Forms\CheckboxField; use SilverStripe\Forms\CheckboxField;
use SilverStripe\Forms\FieldList; use SilverStripe\Forms\FieldList;
use SilverStripe\ORM\DataList;
use SilverStripe\ORM\Filters\PartialMatchFilter; use SilverStripe\ORM\Filters\PartialMatchFilter;
use SilverStripe\ORM\Search\SearchContext; use SilverStripe\ORM\Search\SearchContext;
@ -103,7 +104,6 @@ class SearchContextTest extends SapphireTest
{ {
$company = SearchContextTest\Company::singleton(); $company = SearchContextTest\Company::singleton();
$context = $company->getDefaultSearchContext(); $context = $company->getDefaultSearchContext();
$fields = $context->getFields();
$this->assertEquals( $this->assertEquals(
new FieldList( new FieldList(
new TextField("Name", 'Name'), new TextField("Name", 'Name'),
@ -118,16 +118,18 @@ class SearchContextTest extends SapphireTest
{ {
$action3 = $this->objFromFixture(SearchContextTest\Action::class, 'action3'); $action3 = $this->objFromFixture(SearchContextTest\Action::class, 'action3');
$project = singleton(SearchContextTest\Project::class); $project = SearchContextTest\Project::singleton();
$context = $project->getDefaultSearchContext(); $context = $project->getDefaultSearchContext();
$params = array("Name" => "Blog Website", "Actions__SolutionArea" => "technical"); $params = array("Name" => "Blog Website", "Actions__SolutionArea" => "technical");
/** @var DataList $results */
$results = $context->getResults($params); $results = $context->getResults($params);
$this->assertEquals(1, $results->Count()); $this->assertEquals(1, $results->count());
$project = $results->First(); /** @var SearchContextTest\Project $project */
$project = $results->first();
$this->assertInstanceOf(SearchContextTest\Project::class, $project); $this->assertInstanceOf(SearchContextTest\Project::class, $project);
$this->assertEquals("Blog Website", $project->Name); $this->assertEquals("Blog Website", $project->Name);
@ -247,7 +249,5 @@ class SearchContextTest extends SapphireTest
// "Nothing" should come back null since there's no field for it // "Nothing" should come back null since there's no field for it
$nothing = $list->find('Field', 'Nothing'); $nothing = $list->find('Field', 'Nothing');
$this->assertNull($nothing); $this->assertNull($nothing);
} }
} }

View File

@ -4,7 +4,13 @@ namespace SilverStripe\ORM\Tests\Search\SearchContextTest;
use SilverStripe\Dev\TestOnly; use SilverStripe\Dev\TestOnly;
use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DataObject;
use SilverStripe\ORM\HasManyList;
/**
* @property string $Name
* @method Deadline Deadline()
* @method HasManyList Actions()
*/
class Project extends DataObject implements TestOnly class Project extends DataObject implements TestOnly
{ {
private static $table_name = 'SearchContextTest_Project'; private static $table_name = 'SearchContextTest_Project';