Skip to content

Commit

Permalink
[Tests] Added functional tests coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
ciastektk committed Jan 8, 2024
1 parent 1b4041c commit 3c6eb7e
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions tests/bundle/Functional/SearchView/Criterion/ContentNameTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?php

/**
* @copyright Copyright (C) Ibexa AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/
declare(strict_types=1);

namespace Ibexa\Tests\Bundle\Rest\Functional\SearchView\Criterion;

use Ibexa\Tests\Bundle\Rest\Functional\SearchView\SearchCriterionTestCase;

/**
* @covers \Ibexa\Rest\Server\Input\Parser\Criterion\ContentName
*/
final class ContentNameTest extends SearchCriterionTestCase
{
protected function setUp(): void
{
parent::setUp();

$this->createFolder('foo', '/api/ibexa/v2/content/locations/1/2');
$this->createFolder('foobar', '/api/ibexa/v2/content/locations/1/2');
}

/**
* @return iterable<array{
* string,
* string,
* int,
* }>
*/
public function getCriteriaPayloads(): iterable
{
yield 'Return content items that contain "foo" in name' => [
'json',
$this->buildJsonCriterionQuery('"ContentNameCriterion": "foo*"'),
2,
];

yield 'No content items found with article in name' => [
'json',
$this->buildJsonCriterionQuery('"ContentNameCriterion": "*article*"'),
0,
];
}
}

0 comments on commit 3c6eb7e

Please sign in to comment.