|
| 1 | +<?php |
| 2 | +declare(strict_types=1); |
| 3 | + |
| 4 | +namespace Flowpack\SimpleSearch\ContentRepositoryAdaptor\Tests\Functional\Service; |
| 5 | + |
| 6 | +/* |
| 7 | + * This file is part of the Flowpack.ElasticSearch.ContentRepositoryAdaptor package. |
| 8 | + * |
| 9 | + * (c) Contributors of the Neos Project - www.neos.io |
| 10 | + * |
| 11 | + * This package is Open Source Software. For the full copyright and license |
| 12 | + * information, please view the LICENSE file which was distributed with this |
| 13 | + * source code. |
| 14 | + */ |
| 15 | + |
| 16 | +use Flowpack\SimpleSearch\ContentRepositoryAdaptor\Service\NodeTypeIndexingConfiguration; |
| 17 | +use Neos\ContentRepository\Domain\Service\NodeTypeManager; |
| 18 | +use Neos\Flow\Tests\FunctionalTestCase; |
| 19 | + |
| 20 | +class NodeTypeIndexingConfigurationTest extends FunctionalTestCase |
| 21 | +{ |
| 22 | + |
| 23 | + /** |
| 24 | + * @var NodeTypeManager |
| 25 | + */ |
| 26 | + protected $nodeTypeManager; |
| 27 | + |
| 28 | + /** |
| 29 | + * @var NodeTypeIndexingConfiguration |
| 30 | + */ |
| 31 | + protected $nodeTypeIndexingConfiguration; |
| 32 | + |
| 33 | + public function setUp(): void |
| 34 | + { |
| 35 | + parent::setUp(); |
| 36 | + $this->nodeTypeManager = $this->objectManager->get(NodeTypeManager::class); |
| 37 | + $this->nodeTypeIndexingConfiguration = $this->objectManager->get(NodeTypeIndexingConfiguration::class); |
| 38 | + } |
| 39 | + |
| 40 | + public function nodeTypeDataProvider(): array |
| 41 | + { |
| 42 | + return [ |
| 43 | + 'notIndexable' => [ |
| 44 | + 'nodeTypeName' => 'Flowpack.SimpleSearch.ContentRepositoryAdaptor:Type1', |
| 45 | + 'expected' => false, |
| 46 | + ], |
| 47 | + 'indexable' => [ |
| 48 | + 'nodeTypeName' => 'Flowpack.SimpleSearch.ContentRepositoryAdaptor:Type2', |
| 49 | + 'expected' => true, |
| 50 | + ], |
| 51 | + ]; |
| 52 | + } |
| 53 | + |
| 54 | + /** |
| 55 | + * @test |
| 56 | + * @dataProvider nodeTypeDataProvider |
| 57 | + * |
| 58 | + * @param string $nodeTypeName |
| 59 | + * @param bool $expected |
| 60 | + * @throws \Neos\ContentRepository\Exception\NodeTypeNotFoundException |
| 61 | + */ |
| 62 | + public function isIndexable(string $nodeTypeName, bool $expected): void |
| 63 | + { |
| 64 | + self::assertEquals($expected, $this->nodeTypeIndexingConfiguration->isIndexable($this->nodeTypeManager->getNodeType($nodeTypeName))); |
| 65 | + } |
| 66 | + |
| 67 | + /** |
| 68 | + * @test |
| 69 | + * @dataProvider nodeTypeDataProvider |
| 70 | + * |
| 71 | + * @param string $nodeTypeName |
| 72 | + * @param bool $expected |
| 73 | + */ |
| 74 | + public function getIndexableConfiguration(string $nodeTypeName, bool $expected): void |
| 75 | + { |
| 76 | + $indexableConfiguration = $this->nodeTypeIndexingConfiguration->getIndexableConfiguration(); |
| 77 | + self::assertEquals($indexableConfiguration[$nodeTypeName], $expected); |
| 78 | + } |
| 79 | +} |
0 commit comments