Skip to content

Commit b47ddb8

Browse files
semteacheribernhardf
authored andcommitted
rename class and file according to spec. and additional linting (#69)
1 parent fa2ba51 commit b47ddb8

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

tests/base_tests.php renamed to tests/base_test.php

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,6 @@
3434
use local_wunderbyte_table\filters\types\standardfilter;
3535
use moodle_exception;
3636

37-
defined('MOODLE_INTERNAL') || die();
38-
global $CFG;
39-
4037
/**
4138
* Test base functionality of wunderbyte_table
4239
*
@@ -46,7 +43,7 @@
4643
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
4744
*
4845
*/
49-
final class base_tests extends advanced_testcase {
46+
final class base_test extends advanced_testcase {
5047
/**
5148
* Tests set up.
5249
*/
@@ -78,23 +75,23 @@ public function test_query_db_cached(): void {
7875
$nrofrows = $this->get_rowscount_for_table($table);
7976

8077
// Now we get back exactly 10.
81-
$this->assertEquals($nrofrows, 10);
78+
$this->assertEquals(10, $nrofrows);
8279

8380
// Now we create another three courses.
8481
$this->create_test_courses(3, ['fullname' => 'filtercourse']);
8582

8683
$nrofrows = $this->get_rowscount_for_table($table);
8784

8885
// Because of caching kicking in, we still get 10 items.
89-
$this->assertEquals($nrofrows, 10);
86+
$this->assertEquals(10, $nrofrows);
9087

9188
// Now we purge the cache.
9289
cache_helper::purge_by_event('changesinwunderbytetable');
9390

9491
$nrofrows = $this->get_rowscount_for_table($table);
9592

9693
// After purging, we expect 13.
97-
$this->assertEquals($nrofrows, 13);
94+
$this->assertEquals(13, $nrofrows);
9895

9996
// Now we want to test pagination.
10097
$this->create_test_courses(30);
@@ -104,12 +101,12 @@ public function test_query_db_cached(): void {
104101

105102
$nrofrows = $this->get_rowscount_for_table($table);
106103

107-
$this->assertEquals($nrofrows, 20);
104+
$this->assertEquals(20, $nrofrows);
108105

109106
// Now we fetch the third page. With 43 coures, we expect only three rows now.
110107
$nrofrows = $this->get_rowscount_for_table($table, 2);
111108

112-
$this->assertEquals($nrofrows, 3);
109+
$this->assertEquals(3, $nrofrows);
113110

114111
// Now we fetch the third page. With 43 coures, we expect only three rows now.
115112
$nrofrows = $this->get_rowscount_for_table(
@@ -123,9 +120,7 @@ public function test_query_db_cached(): void {
123120
'{"fullname":["filtercourse"]}'
124121
);
125122

126-
$this->assertEquals($nrofrows, 3);
127-
128-
// throw new moodle_exception('x', 'x', '', json_encode($table->rawdata));
123+
$this->assertEquals(3, $nrofrows);
129124
}
130125

131126
/**
@@ -173,6 +168,7 @@ public function create_demo2_table() {
173168
* Create a defined number of testcourses.
174169
*
175170
* @param int $coursestocreate
171+
* @param array $options
176172
* @return array
177173
*
178174
*/

0 commit comments

Comments
 (0)