Skip to content

Commit 056b06e

Browse files
committed
Fix all tests
1 parent d845021 commit 056b06e

File tree

7 files changed

+329
-275
lines changed

7 files changed

+329
-275
lines changed

tests/console/create_test.php

Lines changed: 16 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
namespace phpbb\skeleton\tests\console;
1515

1616
use phpbb\exception\runtime_exception;
17+
use phpbb_test_case;
18+
use RuntimeException;
1719
use Symfony\Component\Console\Application;
1820
use Symfony\Component\Console\Input\InputInterface;
1921
use Symfony\Component\Console\Output\OutputInterface;
@@ -26,39 +28,30 @@
2628
use phpbb\user;
2729
use PHPUnit\Framework\MockObject\MockObject;
2830

29-
class create_test extends \phpbb_test_case
31+
class create_test extends phpbb_test_case
3032
{
31-
/** @var language|MockObject */
32-
protected $language;
33-
34-
/** @var user|MockObject */
35-
protected $user;
36-
37-
/** @var packager|MockObject */
38-
protected $packager;
39-
40-
/** @var validator|MockObject */
41-
protected $validator;
42-
43-
/** @var string|null */
44-
protected $command_name;
33+
protected language|MockObject $language;
34+
protected user|MockObject $user;
35+
protected packager|MockObject $packager;
36+
protected MockObject|validator $validator;
37+
protected string|null $command_name;
4538

4639
public function setUp(): void
4740
{
48-
$this->language = $this->getMockBuilder('\phpbb\language\language')
41+
$this->language = $this->getMockBuilder(language::class)
4942
->disableOriginalConstructor()
5043
->getMock();
5144

5245
$this->language->method('lang')
53-
->will($this->returnArgument(0));
46+
->willReturnArgument(0);
5447

55-
$this->user = $this->user = $this->getMockBuilder('\phpbb\user')
48+
$this->user = $this->getMockBuilder(user::class)
5649
->disableOriginalConstructor()
5750
->getMock();
5851

5952
$this->validator = new validator($this->language);
6053

61-
$this->packager = $this->getMockBuilder('\phpbb\skeleton\helper\packager')
54+
$this->packager = $this->getMockBuilder(packager::class)
6255
->disableOriginalConstructor()
6356
->getMock();
6457

@@ -127,7 +120,7 @@ public function get_command_tester($question_answers = []): CommandTester
127120

128121
foreach ($question_answers as $expected_question => $answer)
129122
{
130-
if (strpos($text, $expected_question) !== false)
123+
if (str_contains($text, $expected_question))
131124
{
132125
$response = $answer;
133126

@@ -140,7 +133,7 @@ public function get_command_tester($question_answers = []): CommandTester
140133

141134
if (!isset($response))
142135
{
143-
throw new \RuntimeException('Was asked for input on an unhandled question: ' . $text);
136+
throw new RuntimeException('Was asked for input on an unhandled question: ' . $text);
144137
}
145138

146139
$output->writeln(print_r($response, true));
@@ -158,7 +151,7 @@ public function get_command_tester($question_answers = []): CommandTester
158151
return new CommandTester($command);
159152
}
160153

161-
public function get_questions()
154+
public function get_questions(): array
162155
{
163156
return [
164157
'SKELETON_QUESTION_VENDOR_NAME' => 'foo',
@@ -211,7 +204,7 @@ public function test_create()
211204
$this->assertStringContainsString('EXTENSION_CLI_SKELETON_SUCCESS', $command_tester->getDisplay());
212205
}
213206

214-
public function invalid_data()
207+
public function invalid_data(): array
215208
{
216209
return [
217210
[['SKELETON_QUESTION_VENDOR_NAME' => 'foo bar']],

0 commit comments

Comments
 (0)