Fix wrong namespace + Add RangeFunctionTest
Signed-off-by: davidarendsen <davidarendsen@hey.com>
This commit is contained in:
parent
648709bd19
commit
41cdf265dc
2 changed files with 37 additions and 1 deletions
|
|
@ -3,7 +3,7 @@
|
||||||
namespace Arendsen\FluxQueryBuilder\Functions;
|
namespace Arendsen\FluxQueryBuilder\Functions;
|
||||||
|
|
||||||
use Arendsen\FluxQueryBuilder\Formatters;
|
use Arendsen\FluxQueryBuilder\Formatters;
|
||||||
use Arendsen\FluxQueryBuilder\Function\FunctionNotImplementedException;
|
use Arendsen\FluxQueryBuilder\Exception\FunctionNotImplementedException;
|
||||||
|
|
||||||
abstract class Base {
|
abstract class Base {
|
||||||
|
|
||||||
|
|
|
||||||
36
tests/Functions/RangeFunctionTest.php
Normal file
36
tests/Functions/RangeFunctionTest.php
Normal file
|
|
@ -0,0 +1,36 @@
|
||||||
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
use Arendsen\FluxQueryBuilder\Exception\FunctionRequiredSettingMissingException;
|
||||||
|
use Arendsen\FluxQueryBuilder\Functions\Range;
|
||||||
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
|
final class RangeFunctionTest extends TestCase {
|
||||||
|
|
||||||
|
public function testOnlyStartOption()
|
||||||
|
{
|
||||||
|
$expression = new Range(['start' => '-360h']);
|
||||||
|
|
||||||
|
$query = '|> range(start: -360h) ';
|
||||||
|
|
||||||
|
$this->assertEquals($query, $expression->__toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testWithStopOption()
|
||||||
|
{
|
||||||
|
$expression = new Range(['start' => '-360h', 'stop' => 'now()']);
|
||||||
|
|
||||||
|
$query = '|> range(start: -360h, stop: now()) ';
|
||||||
|
|
||||||
|
$this->assertEquals($query, $expression->__toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testThrowsExceptionWhenStartIsMissing()
|
||||||
|
{
|
||||||
|
$this->expectException(FunctionRequiredSettingMissingException::class);
|
||||||
|
|
||||||
|
$expression = new Range(['stop' => 'now()']);
|
||||||
|
$expression->__toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Add table
editor.link_modal.header
Reference in a new issue