2022-09-01 13:29:27 +00:00
|
|
|
<?php
|
|
|
|
|
|
2024-03-30 16:44:38 +01:00
|
|
|
declare( strict_types=1 );
|
2022-09-01 13:29:27 +00:00
|
|
|
|
|
|
|
|
namespace Tests\Functions;
|
|
|
|
|
|
2024-03-30 16:44:38 +01:00
|
|
|
use Hosterra\FluxBuilder\Functions\Mean;
|
2022-09-01 13:29:27 +00:00
|
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
|
|
2024-03-30 16:44:38 +01:00
|
|
|
final class MeanFunctionTest extends TestCase {
|
|
|
|
|
public function testSimpleMean() {
|
|
|
|
|
$expression = new Mean();
|
2022-09-01 13:29:27 +00:00
|
|
|
|
2024-03-30 16:44:38 +01:00
|
|
|
$query = '|> mean() ';
|
2022-09-01 13:29:27 +00:00
|
|
|
|
2024-03-30 16:44:38 +01:00
|
|
|
$this->assertEquals( $query, $expression->__toString() );
|
|
|
|
|
}
|
2022-09-01 13:29:27 +00:00
|
|
|
|
2024-03-30 16:44:38 +01:00
|
|
|
public function testWithParameterColumn() {
|
|
|
|
|
$expression = new Mean( 'test' );
|
2022-09-01 13:29:27 +00:00
|
|
|
|
2024-03-30 16:44:38 +01:00
|
|
|
$query = '|> mean(column: "test") ';
|
2022-09-01 13:29:27 +00:00
|
|
|
|
2024-03-30 16:44:38 +01:00
|
|
|
$this->assertEquals( $query, $expression->__toString() );
|
|
|
|
|
}
|
2022-09-01 13:29:27 +00:00
|
|
|
}
|