-
Notifications
You must be signed in to change notification settings - Fork 824
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
39 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
namespace SilverStripe\ORM\Tests; | ||
|
||
use SilverStripe\Dev\SapphireTest; | ||
use SilverStripe\ORM\DataObject; | ||
use SilverStripe\ORM\DataQuery; | ||
|
||
class DataQueryFixedFieldsTest extends SapphireTest | ||
{ | ||
protected static $fixture_file = 'DataQueryFixedFieldsTest.yml'; | ||
|
||
protected static $extra_dataobjects = [ | ||
DataQueryTest\ObjectA::class, | ||
]; | ||
|
||
public static function setUpBeforeClass(): void | ||
{ | ||
parent::setUpBeforeClass(); | ||
DataObject::config()->merge('fixed_fields', ['ExtraFixedField' => 'Varchar']); | ||
static::tempDB()->resetDBSchema(static::$extra_dataobjects); | ||
} | ||
|
||
public function testDataQueryHasFixedFields() | ||
{ | ||
$dataQuery = new DataQuery(DataQueryTest\ObjectA::class); | ||
$dataQuery->setQueriedColumns(['Name']); | ||
$this->assertSame(['This is the field'], $dataQuery->execute()->column('ExtraFixedField')); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
SilverStripe\ORM\Tests\DataQueryTest\ObjectA: | ||
query1: | ||
Name: 'Only one object' | ||
ExtraFixedField: 'This is the field' |