Skip to content

Commit 740a054

Browse files
committed
Fix tests
1 parent 100fbab commit 740a054

File tree

3 files changed

+10
-19
lines changed

3 files changed

+10
-19
lines changed

tests/controller/main_test.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,12 @@ public function test_submit_exception(): void
416416
return null;
417417
});
418418

419-
$this->get_controller($this->packager_mock)->handle();
419+
$this->controller_helper->expects($this->once())
420+
->method('render')
421+
->willReturn(new Response(''));
422+
423+
$response = $this->get_controller($this->packager_mock)->handle();
424+
425+
$this->assertInstanceOf(Response::class, $response);
420426
}
421427
}

tests/ext_test.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,6 @@ public function test_is_enableable_true(): void
4343
->onlyMethods(['ziparchive_exists', 'phpbb_requirement', 'php_requirement'])
4444
->getMock();
4545

46-
$ext->method('ziparchive_exists')->willReturn(null);
47-
$ext->method('phpbb_requirement')->willReturn(null);
48-
$ext->method('php_requirement')->willReturn(null);
49-
5046
$this->setExtErrors($ext, []);
5147
$this->assertTrue($ext->is_enableable());
5248
}
@@ -61,8 +57,6 @@ public function test_is_enableable_with_errors(): void
6157
$ext->method('ziparchive_exists')->willReturnCallback(function () use ($ext) {
6258
$this->appendExtError($ext, 'NO_ZIPARCHIVE_ERROR');
6359
});
64-
$ext->method('phpbb_requirement')->willReturn(null);
65-
$ext->method('php_requirement')->willReturn(null);
6660
$ext->method('enable_failed')->willReturn(['NO_ZIPARCHIVE_ERROR']);
6761

6862
$this->setExtErrors($ext, ['NO_ZIPARCHIVE_ERROR']);

tests/helper/validator_test.php

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -65,16 +65,16 @@ public static function valid_data(): array
6565
['extension_homepage', 'http://www.web.com'],
6666
['extension_homepage', 'https://web.com'],
6767
['extension_homepage', ''],
68-
['extension_homepage', null],
68+
['extension_homepage', ''],
6969

7070
['author_homepage', 'http://www.web.com'],
7171
['author_homepage', 'https://web.com'],
7272
['author_homepage', ''],
73-
['author_homepage', null],
73+
['author_homepage', ''],
7474

7575
['author_email', 'user@web.com'],
7676
['author_email', ''],
77-
['author_email', null],
77+
['author_email', ''],
7878

7979
['phpbb_version_min', '1.0.0'],
8080
['phpbb_version_min', '>1.0.0'],
@@ -133,7 +133,6 @@ public static function invalid_data(): array
133133
['num_authors', '-1', 'SKELETON_INVALID_NUM_AUTHORS'],
134134
['num_authors', '0', 'SKELETON_INVALID_NUM_AUTHORS'],
135135
['num_authors', '', 'SKELETON_INVALID_NUM_AUTHORS'],
136-
['num_authors', null, 'SKELETON_INVALID_NUM_AUTHORS'],
137136
['num_authors', 'foo', 'SKELETON_INVALID_NUM_AUTHORS'],
138137
['num_authors', '$foo', 'SKELETON_INVALID_NUM_AUTHORS'],
139138

@@ -144,16 +143,13 @@ public static function invalid_data(): array
144143
['extension_name', '01foo', 'SKELETON_INVALID_PACKAGE_NAME'],
145144
['extension_name', 'foo$bar', 'SKELETON_INVALID_PACKAGE_NAME'],
146145
['extension_name', '', 'SKELETON_INVALID_PACKAGE_NAME'],
147-
['extension_name', null, 'SKELETON_INVALID_PACKAGE_NAME'],
148146

149147
['extension_display_name', '', 'SKELETON_INVALID_DISPLAY_NAME'],
150-
['extension_display_name', null, 'SKELETON_INVALID_DISPLAY_NAME'],
151148
['extension_display_name', 'Foo bar"s world', 'SKELETON_INVALID_DISPLAY_NAME'],
152149

153150
['extension_time', '00-00-0000', 'SKELETON_INVALID_EXTENSION_TIME'],
154151
['extension_time', 'FOO', 'SKELETON_INVALID_EXTENSION_TIME'],
155152
['extension_time', '', 'SKELETON_INVALID_EXTENSION_TIME'],
156-
['extension_time', null, 'SKELETON_INVALID_EXTENSION_TIME'],
157153

158154
['extension_version', '1', 'SKELETON_INVALID_EXTENSION_VERSION'],
159155
['extension_version', '1.0.0-RC', 'SKELETON_INVALID_EXTENSION_VERSION'],
@@ -163,7 +159,6 @@ public static function invalid_data(): array
163159
['extension_version', '1.0.0-foo', 'SKELETON_INVALID_EXTENSION_VERSION'],
164160
['extension_version', '1.0.0-foo1', 'SKELETON_INVALID_EXTENSION_VERSION'],
165161
['extension_version', '', 'SKELETON_INVALID_EXTENSION_VERSION'],
166-
['extension_version', null, 'SKELETON_INVALID_EXTENSION_VERSION'],
167162
['extension_version', 'foo', 'SKELETON_INVALID_EXTENSION_VERSION'],
168163
['extension_version', '1.0.0.0.0', 'SKELETON_INVALID_EXTENSION_VERSION'],
169164

@@ -175,7 +170,6 @@ public static function invalid_data(): array
175170
['vendor_name', '01foo', 'SKELETON_INVALID_VENDOR_NAME'],
176171
['vendor_name', 'foo$bar', 'SKELETON_INVALID_VENDOR_NAME'],
177172
['vendor_name', '', 'SKELETON_INVALID_VENDOR_NAME'],
178-
['vendor_name', null, 'SKELETON_INVALID_VENDOR_NAME'],
179173

180174
['extension_homepage', 'www.web.com', 'SKELETON_INVALID_EXTENSION_URL'],
181175
['extension_homepage', 'foo', 'SKELETON_INVALID_EXTENSION_URL'],
@@ -188,23 +182,20 @@ public static function invalid_data(): array
188182
['author_email', 'foo', 'SKELETON_INVALID_AUTHOR_EMAIL'],
189183

190184
['phpbb_version_min', '', 'SKELETON_INVALID_PHPBB_MIN_VERSION'],
191-
['phpbb_version_min', null, 'SKELETON_INVALID_PHPBB_MIN_VERSION'],
192185
['phpbb_version_min', 'foo', 'SKELETON_INVALID_PHPBB_MIN_VERSION'],
193186
['phpbb_version_min', '~1.0.0', 'SKELETON_INVALID_PHPBB_MIN_VERSION'],
194187
['phpbb_version_min', '^1.0.0', 'SKELETON_INVALID_PHPBB_MIN_VERSION'],
195188
['phpbb_version_min', '1.0.0 | 2.0.0', 'SKELETON_INVALID_PHPBB_MIN_VERSION'],
196189
['phpbb_version_min', '>=5.4', 'SKELETON_INVALID_PHPBB_MIN_VERSION'],
197190

198191
['phpbb_version_max', '', 'SKELETON_INVALID_PHPBB_MAX_VERSION'],
199-
['phpbb_version_max', null, 'SKELETON_INVALID_PHPBB_MAX_VERSION'],
200192
['phpbb_version_max', 'foo', 'SKELETON_INVALID_PHPBB_MAX_VERSION'],
201193
['phpbb_version_max', '~1.0.0', 'SKELETON_INVALID_PHPBB_MAX_VERSION'],
202194
['phpbb_version_max', '^1.0.0', 'SKELETON_INVALID_PHPBB_MAX_VERSION'],
203195
['phpbb_version_max', '1.0.0 | 2.0.0', 'SKELETON_INVALID_PHPBB_MAX_VERSION'],
204196
['phpbb_version_max', '>=5.4', 'SKELETON_INVALID_PHPBB_MAX_VERSION'],
205197

206198
['php_version', '', 'SKELETON_INVALID_PHP_VERSION'],
207-
['php_version', null, 'SKELETON_INVALID_PHP_VERSION'],
208199
['php_version', 'foo', 'SKELETON_INVALID_PHP_VERSION'],
209200
['php_version', '~1.0.0', 'SKELETON_INVALID_PHP_VERSION'],
210201
['php_version', '^1.0.0', 'SKELETON_INVALID_PHP_VERSION'],

0 commit comments

Comments
 (0)