34
34
use local_wunderbyte_table \filters \types \standardfilter ;
35
35
use moodle_exception ;
36
36
37
- defined ('MOODLE_INTERNAL ' ) || die ();
38
- global $ CFG ;
39
-
40
37
/**
41
38
* Test base functionality of wunderbyte_table
42
39
*
46
43
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
47
44
*
48
45
*/
49
- final class base_tests extends advanced_testcase {
46
+ final class base_test extends advanced_testcase {
50
47
/**
51
48
* Tests set up.
52
49
*/
@@ -78,23 +75,23 @@ public function test_query_db_cached(): void {
78
75
$ nrofrows = $ this ->get_rowscount_for_table ($ table );
79
76
80
77
// Now we get back exactly 10.
81
- $ this ->assertEquals ($ nrofrows , 10 );
78
+ $ this ->assertEquals (10 , $ nrofrows );
82
79
83
80
// Now we create another three courses.
84
81
$ this ->create_test_courses (3 , ['fullname ' => 'filtercourse ' ]);
85
82
86
83
$ nrofrows = $ this ->get_rowscount_for_table ($ table );
87
84
88
85
// Because of caching kicking in, we still get 10 items.
89
- $ this ->assertEquals ($ nrofrows , 10 );
86
+ $ this ->assertEquals (10 , $ nrofrows );
90
87
91
88
// Now we purge the cache.
92
89
cache_helper::purge_by_event ('changesinwunderbytetable ' );
93
90
94
91
$ nrofrows = $ this ->get_rowscount_for_table ($ table );
95
92
96
93
// After purging, we expect 13.
97
- $ this ->assertEquals ($ nrofrows , 13 );
94
+ $ this ->assertEquals (13 , $ nrofrows );
98
95
99
96
// Now we want to test pagination.
100
97
$ this ->create_test_courses (30 );
@@ -104,12 +101,12 @@ public function test_query_db_cached(): void {
104
101
105
102
$ nrofrows = $ this ->get_rowscount_for_table ($ table );
106
103
107
- $ this ->assertEquals ($ nrofrows , 20 );
104
+ $ this ->assertEquals (20 , $ nrofrows );
108
105
109
106
// Now we fetch the third page. With 43 coures, we expect only three rows now.
110
107
$ nrofrows = $ this ->get_rowscount_for_table ($ table , 2 );
111
108
112
- $ this ->assertEquals ($ nrofrows , 3 );
109
+ $ this ->assertEquals (3 , $ nrofrows );
113
110
114
111
// Now we fetch the third page. With 43 coures, we expect only three rows now.
115
112
$ nrofrows = $ this ->get_rowscount_for_table (
@@ -123,9 +120,7 @@ public function test_query_db_cached(): void {
123
120
'{"fullname":["filtercourse"]} '
124
121
);
125
122
126
- $ this ->assertEquals ($ nrofrows , 3 );
127
-
128
- // throw new moodle_exception('x', 'x', '', json_encode($table->rawdata));
123
+ $ this ->assertEquals (3 , $ nrofrows );
129
124
}
130
125
131
126
/**
@@ -173,6 +168,7 @@ public function create_demo2_table() {
173
168
* Create a defined number of testcourses.
174
169
*
175
170
* @param int $coursestocreate
171
+ * @param array $options
176
172
* @return array
177
173
*
178
174
*/
0 commit comments