forked from neos/neos-development-collection
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TASK: Readd unit test for sort operation
was previously removed via neos#5036
- Loading branch information
Showing
1 changed file
with
48 additions
and
0 deletions.
There are no files selected for viewing
48 changes: 48 additions & 0 deletions
48
Neos.Neos/Tests/Unit/FlowQueryOperations/SortOperationTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Neos\Neos\Tests\Unit\FlowQueryOperations; | ||
|
||
use Neos\ContentRepository\NodeAccess\FlowQueryOperations\SortOperation; | ||
use Neos\Eel\FlowQuery\FlowQueryException; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
/** | ||
* SortOperation test | ||
*/ | ||
class SortOperationTest extends TestCase | ||
{ | ||
/** | ||
* @test+ | ||
*/ | ||
public function callWithoutArgumentsCausesException() | ||
{ | ||
$this->expectException(FlowQueryException::class); | ||
$flowQuery = new \Neos\Eel\FlowQuery\FlowQuery([]); | ||
$operation = new SortOperation(); | ||
$operation->evaluate($flowQuery, []); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function invalidSortDirectionCausesException() | ||
{ | ||
$this->expectException(FlowQueryException::class); | ||
$flowQuery = new \Neos\Eel\FlowQuery\FlowQuery([]); | ||
$operation = new SortOperation(); | ||
$operation->evaluate($flowQuery, ['title', 'FOO']); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function invalidSortOptionCausesException() | ||
{ | ||
$this->expectException(FlowQueryException::class); | ||
$flowQuery = new \Neos\Eel\FlowQuery\FlowQuery([]); | ||
$operation = new SortOperation(); | ||
$operation->evaluate($flowQuery, ['title', 'ASC', 'SORT_BAR']); | ||
} | ||
} |