Skip to content

Commit

Permalink
TASK: Readd unit test for sort operation
Browse files Browse the repository at this point in the history
was previously removed via neos#5036
  • Loading branch information
mhsdesign committed Jul 3, 2024
1 parent 7554048 commit 1be047a
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions Neos.Neos/Tests/Unit/FlowQueryOperations/SortOperationTest.php
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']);
}
}

0 comments on commit 1be047a

Please sign in to comment.