mirror of
https://github.com/silverstripe/silverstripe-multiform
synced 2024-10-22 11:05:49 +02:00
1331a60fd7
* removed @package references * included stubs in the test namespaces * updated various return types * updated composr psr4 autoload classes * doc update
43 lines
1.3 KiB
PHP
43 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace SilverStripe\MultiForm\Tests;
|
|
|
|
use SilverStripe\Dev\SapphireTest;
|
|
use SilverStripe\MultiForm\Extensions\MultiFormObjectDecorator;
|
|
use SilverStripe\MultiForm\Tests\Stubs\MultiFormObjectDecoratorDataObject;
|
|
|
|
class MultiFormObjectDecoratorTest extends SapphireTest
|
|
{
|
|
protected static $fixture_file = 'MultiFormObjectDecoratorTest.yml';
|
|
|
|
protected static $required_extensions = [
|
|
MultiFormObjectDecoratorDataObject::class => [MultiFormObjectDecorator::class]
|
|
];
|
|
|
|
protected static $extra_dataobjects = [
|
|
MultiFormObjectDecoratorDataObject::class
|
|
];
|
|
|
|
public function testTemporaryDataFilteredQuery()
|
|
{
|
|
$records = MultiFormObjectDecoratorDataObject::get()
|
|
->map('Name')
|
|
->toArray();
|
|
|
|
$this->assertContains('Test 1', $records);
|
|
$this->assertContains('Test 2', $records);
|
|
$this->assertNotContains('Test 3', $records);
|
|
}
|
|
|
|
public function testTemporaryDataQuery()
|
|
{
|
|
$records = MultiFormObjectDecoratorDataObject::get()
|
|
->filter(['MultiFormIsTemporary' => 1])
|
|
->map('Name')
|
|
->toArray();
|
|
$this->assertNotContains('Test 1', $records);
|
|
$this->assertNotContains('Test 2', $records);
|
|
$this->assertContains('Test 3', $records);
|
|
}
|
|
}
|