-
-
Notifications
You must be signed in to change notification settings - Fork 111
Expand file tree
/
Copy pathCollectionFilterTest.php
More file actions
48 lines (39 loc) · 1.44 KB
/
CollectionFilterTest.php
File metadata and controls
48 lines (39 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
declare(strict_types=1);
/*
* This file is part of the Sonata Project package.
*
* (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sonata\ClassificationBundle\Tests\Admin\Filter;
use PHPUnit\Framework\MockObject\Stub;
use PHPUnit\Framework\TestCase;
use Sonata\ClassificationBundle\Admin\Filter\CollectionFilter;
use Sonata\ClassificationBundle\Model\CollectionManagerInterface;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
final class CollectionFilterTest extends TestCase
{
/**
* @var Stub&CollectionManagerInterface
*/
private CollectionManagerInterface $collectionManager;
protected function setUp(): void
{
$this->collectionManager = static::createStub(CollectionManagerInterface::class);
}
public function testRenderSettings(): void
{
$this->collectionManager->method('findAll')->willReturn([]);
$filter = new CollectionFilter($this->collectionManager);
$filter->initialize('field_name', [
'field_options' => ['class' => 'FooBar'],
]);
$options = $filter->getRenderSettings()[1];
static::assertSame(ChoiceType::class, $options['field_type']);
static::assertIsArray($options['field_options']);
static::assertSame([], $options['field_options']['choices']);
}
}