mirror of
https://github.com/silverstripe/silverstripe-multiform
synced 2024-10-22 11:05:49 +02:00
5eb68aa62c
Conflicts: tests/MultiFormTest.php
45 lines
1.1 KiB
PHP
45 lines
1.1 KiB
PHP
<?php
|
|
class MultiFormObjectDecoratorTest extends SapphireTest {
|
|
|
|
protected static $fixture_file = 'MultiFormObjectDecoratorTest.yml';
|
|
|
|
protected $requiredExtensions = array(
|
|
'MultiFormObjectDecorator_DataObject' => array('MultiFormObjectDecorator')
|
|
);
|
|
|
|
protected $extraDataObjects = array(
|
|
'MultiFormObjectDecorator_DataObject'
|
|
);
|
|
|
|
public function testTemporaryDataFilteredQuery() {
|
|
$records = MultiFormObjectDecorator_DataObject::get()
|
|
->map('Name')
|
|
->toArray();
|
|
|
|
$this->assertContains('Test 1', $records);
|
|
$this->assertContains('Test 2', $records);
|
|
$this->assertNotContains('Test 3', $records);
|
|
|
|
}
|
|
|
|
public function testTemporaryDataQuery() {
|
|
$records = MultiFormObjectDecorator_DataObject::get()
|
|
->filter(array('MultiFormIsTemporary' => 1))
|
|
->map('Name')
|
|
->toArray();
|
|
|
|
$this->assertNotContains('Test 1', $records);
|
|
$this->assertNotContains('Test 2', $records);
|
|
$this->assertContains('Test 3', $records);
|
|
}
|
|
|
|
}
|
|
|
|
class MultiFormObjectDecorator_DataObject extends DataObject {
|
|
|
|
private static $db = array(
|
|
'Name' => 'Varchar'
|
|
);
|
|
|
|
}
|