1
1
<?php
2
2
3
- declare (strict_types= 1 );
3
+ declare (strict_types = 1 );
4
4
5
5
namespace Asseco \JsonQueryBuilder \Tests \Unit \SQLProviders ;
6
6
@@ -26,27 +26,41 @@ public function test_it_returns_the_right_functions_query()
26
26
}
27
27
}
28
28
29
- public function test_it_throws_an_exception_if_an_invalid_function_is_given ()
30
- {
31
- $ this ->expectException (\Asseco \JsonQueryBuilder \Exceptions \JsonQueryBuilderException::class);
32
- $ this ->functions ::invalidFunction ('id ' );
33
- }
34
-
35
29
public function test_it_validate_sql_functions ()
36
30
{
31
+ $ this ->expectNotToPerformAssertions ();
37
32
foreach (SQLFunctions::DB_FUNCTIONS as $ fn ) {
38
- $ this ->assertNull ( $ this -> functions ::validateArgument ($ fn . ':column ' ) );
33
+ $ this ->functions ::validateArgument ($ fn . ':column ' );
39
34
}
40
35
}
41
36
42
37
public function test_it_validate_nested_functions_validation ()
43
38
{
44
- $ this ->assertNull ($ this ->functions ::validateArgument ('avg:year:column ' ));
39
+ $ this ->expectNotToPerformAssertions ();
40
+ $ this ->functions ::validateArgument ('avg:year:column ' );
45
41
}
46
42
47
43
public function test_it_bypass_when_no_function_is_given ()
48
44
{
49
- $ this ->assertNull ($ this ->functions ::validateArgument ('column ' ));
45
+ $ this ->expectNotToPerformAssertions ();
46
+ $ this ->functions ::validateArgument ('column ' );
47
+ }
48
+
49
+ public function test_it_validate_custom_aliases ()
50
+ {
51
+ $ this ->expectNotToPerformAssertions ();
52
+ $ this ->functions ::validateArgument ("avg:_column as my_avg " );
53
+ }
54
+
55
+ public function test_it_throws_if_alias_is_not_valid () {
56
+ $ this ->expectException (\Asseco \JsonQueryBuilder \Exceptions \JsonQueryBuilderException::class);
57
+ $ this ->functions ::validateArgument ("avg:column as my_avg`ds " );
58
+ }
59
+
60
+ public function test_it_throws_an_exception_if_an_invalid_function_is_given ()
61
+ {
62
+ $ this ->expectException (\Asseco \JsonQueryBuilder \Exceptions \JsonQueryBuilderException::class);
63
+ $ this ->functions ::invalidFunction ('id ' );
50
64
}
51
65
52
66
public function test_it_throws_an_exception_if_an_invalid_argument_is_given ()
@@ -58,7 +72,7 @@ public function test_it_throws_an_exception_if_an_invalid_argument_is_given()
58
72
public function test_it_throws_an_exception_if_an_invalid_column_is_given ()
59
73
{
60
74
$ this ->expectException (\Asseco \JsonQueryBuilder \Exceptions \JsonQueryBuilderException::class);
61
- $ this ->functions ::validateArgument ("avg:'this--sql-scripting-is-invalid' " );
75
+ $ this ->functions ::validateArgument ("avg:'this--sql-scripting-is-` invalid' " );
62
76
}
63
77
64
78
public function test_it_throws_an_exception_if_no_column_is_given ()
0 commit comments