forked from tractorcow-farm/silverstripe-fluent
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request tractorcow-farm#303 from creative-commoners/pulls/…
…4.0/localised-fields Individual fields whitelisting option added.
- Loading branch information
Showing
6 changed files
with
232 additions
and
26 deletions.
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
25 changes: 25 additions & 0 deletions
25
tests/php/Extension/FluentExtensionTest/LocalisedAnother.php
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,25 @@ | ||
<?php | ||
|
||
namespace TractorCow\Fluent\Tests\Extension\FluentExtensionTest; | ||
|
||
use SilverStripe\Dev\TestOnly; | ||
|
||
class LocalisedAnother extends LocalisedParent implements TestOnly | ||
{ | ||
private static $table_name = 'FluentExtensionTest_LocalisedAnother'; | ||
|
||
private static $field_exclude = [ | ||
'Record', // overrides data_include varchar | ||
]; | ||
|
||
private static $field_include = [ | ||
'Data' // overrides data_exclude varchar(100) | ||
]; | ||
|
||
private static $db = [ | ||
'Record' => 'Varchar', | ||
'Bastion' => 'Varchar', | ||
'Data' => 'Varchar(100)', | ||
'Cycle' => 'Varchar(100)', | ||
]; | ||
} |
19 changes: 19 additions & 0 deletions
19
tests/php/Extension/FluentExtensionTest/LocalisedChild.php
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,19 @@ | ||
<?php | ||
|
||
namespace TractorCow\Fluent\Tests\Extension\FluentExtensionTest; | ||
|
||
use SilverStripe\Dev\TestOnly; | ||
|
||
class LocalisedChild extends LocalisedParent implements TestOnly | ||
{ | ||
private static $table_name = 'FluentExtensionTest_LocalisedChild'; | ||
|
||
private static $translate = [ | ||
'Record', | ||
]; | ||
|
||
private static $db = [ | ||
'Record' => 'Text', | ||
'Data' => 'Text', | ||
]; | ||
} |
33 changes: 33 additions & 0 deletions
33
tests/php/Extension/FluentExtensionTest/LocalisedParent.php
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,33 @@ | ||
<?php | ||
|
||
namespace TractorCow\Fluent\Tests\Extension\FluentExtensionTest; | ||
|
||
use SilverStripe\Dev\TestOnly; | ||
use SilverStripe\ORM\DataObject; | ||
use TractorCow\Fluent\Extension\FluentExtension; | ||
|
||
/** | ||
* @mixin FluentExtension | ||
*/ | ||
class LocalisedParent extends DataObject implements TestOnly | ||
{ | ||
private static $table_name = 'FluentExtensionTest_LocalisedParent'; | ||
|
||
private static $extensions = [ | ||
'FluentExtension' => FluentExtension::class, | ||
]; | ||
|
||
private static $data_include = [ | ||
'Varchar', | ||
]; | ||
|
||
private static $data_exclude = [ | ||
'Varchar(100)', | ||
]; | ||
|
||
private static $db = [ | ||
'Title' => 'Varchar', | ||
'Description' => 'Varchar(100)', | ||
'Details' => 'Varchar(200)', | ||
]; | ||
} |
17 changes: 17 additions & 0 deletions
17
tests/php/Extension/FluentExtensionTest/UnlocalisedChild.php
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,17 @@ | ||
<?php | ||
|
||
namespace TractorCow\Fluent\Tests\Extension\FluentExtensionTest; | ||
|
||
use SilverStripe\Dev\TestOnly; | ||
|
||
class UnlocalisedChild extends LocalisedParent implements TestOnly | ||
{ | ||
private static $table_name = 'FluentExtensionTest_UnlocalisedChild'; | ||
|
||
private static $translate = 'none'; | ||
|
||
private static $db = [ | ||
'Record' => 'Text', | ||
'Data' => 'Text', | ||
]; | ||
} |