Skip to content

Commit 745ec82

Browse files
committed
composer: allow Symfony6 + phpunit upgrade
1 parent 8357c08 commit 745ec82

File tree

8 files changed

+62
-58
lines changed

8 files changed

+62
-58
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
vendor/*
2+
.phpunit.result.cache
3+
composer.lock

composer.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,17 @@
1313
],
1414
"require": {
1515
"php": ">=7.2.0",
16-
"symfony/console": "~2.3|~3.0|~4.0|~5.0",
17-
"symfony/dependency-injection": "~2.3|~3.0|~4.0|~5.0",
18-
"symfony/expression-language": "~2.4|~3.0|~4.0|~5.0",
19-
"symfony/filesystem": "~2.3|~3.0|~4.0|~5.0",
20-
"symfony/http-foundation": "~2.3|~3.0|~4.0|~5.0",
21-
"symfony/http-kernel": "~2.3|~3.0|~4.0|~5.0",
16+
"symfony/console": "~2.3|~3.0|~4.0|~5.0|~6.0",
17+
"symfony/dependency-injection": "~2.3|~3.0|~4.0|~5.0|~6.0",
18+
"symfony/expression-language": "~2.4|~3.0|~4.0|~5.0|~6.0",
19+
"symfony/filesystem": "~2.3|~3.0|~4.0|~5.0|~6.0",
20+
"symfony/http-foundation": "~2.3|~3.0|~4.0|~5.0|~6.0",
21+
"symfony/http-kernel": "~2.3|~3.0|~4.0|~5.0|~6.0",
2222
"symfony/polyfill-mbstring": "^1.3",
23-
"symfony/process": "~2.3|~3.0|~4.0|~5.0"
23+
"symfony/process": "~2.3|~3.0|~4.0|~5.0|~6.0"
2424
},
2525
"require-dev": {
26-
"phpunit/phpunit": "^6.1"
26+
"phpunit/phpunit": "^9.5"
2727
},
2828
"config": {
2929
"sort-packages": true

tests/Configuration/ConfigurationAdapterTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class ConfigurationAdapterTest extends TestCase
2121
/** @var DefaultConfiguration */
2222
private $config;
2323

24-
protected function setUp()
24+
protected function setUp(): void
2525
{
2626
$this->config = (new DefaultConfiguration(__DIR__))
2727
->sharedFilesAndDirs([])
@@ -32,7 +32,7 @@ protected function setUp()
3232
;
3333
}
3434

35-
public function test_get_options()
35+
public function test_get_options(): void
3636
{
3737
$config = new ConfigurationAdapter($this->config);
3838

tests/Configuration/DefaultConfigurationTest.php

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,34 +12,36 @@
1212
namespace EasyCorp\Bundle\EasyDeployBundle\Tests;
1313

1414
use EasyCorp\Bundle\EasyDeployBundle\Configuration\DefaultConfiguration;
15+
use EasyCorp\Bundle\EasyDeployBundle\Exception\InvalidConfigurationException;
1516
use PHPUnit\Framework\TestCase;
1617

1718
class DefaultConfigurationTest extends TestCase
1819
{
1920
/**
2021
* @dataProvider provideHttpRepositoryUrls
21-
* @expectedException \EasyCorp\Bundle\EasyDeployBundle\Exception\InvalidConfigurationException
22-
* @expectedExceptionMessageRegExp /The repository URL must use the SSH syntax instead of the HTTPs syntax to make it work on any remote server. Replace "https?:\/\/.*\/symfony\/symfony-demo.git" by "git@.*:symfony\/symfony-demo.git"/
2322
*/
24-
public function test_repository_url_protocol(string $url)
23+
public function test_repository_url_protocol(string $url): void
2524
{
25+
$this->expectException(InvalidConfigurationException::class);
26+
$this->expectExceptionMessageMatches('/The repository URL must use the SSH syntax instead of the HTTPs syntax to make it work on any remote server. Replace "https?:\/\/.*\/symfony\/symfony-demo.git" by "git@.*:symfony\/symfony-demo.git"/');
27+
2628
(new DefaultConfiguration(__DIR__))
2729
->repositoryUrl($url)
2830
;
2931
}
3032

31-
/**
32-
* @expectedException \EasyCorp\Bundle\EasyDeployBundle\Exception\InvalidConfigurationException
33-
* @expectedExceptionMessage The value of resetOpCacheFor option must be the valid URL of your homepage (it must start with http:// or https://).
34-
*/
35-
public function test_reset_opcache_for()
33+
public function test_reset_opcache_for(): void
3634
{
35+
$this->expectException(InvalidConfigurationException::class);
36+
$this->expectExceptionMessage('The value of resetOpCacheFor option must be the valid URL of your homepage (it must start with http:// or https://).');
37+
38+
3739
(new DefaultConfiguration(__DIR__))
3840
->resetOpCacheFor('symfony.com')
3941
;
4042
}
4143

42-
public function provideHttpRepositoryUrls()
44+
public function provideHttpRepositoryUrls(): ?\Generator
4345
{
4446
yield ['http://github.com/symfony/symfony-demo.git'];
4547
yield ['https://github.com/symfony/symfony-demo.git'];

tests/Helper/StrTest.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,36 +17,36 @@
1717
class StrTest extends TestCase
1818
{
1919
/** @dataProvider startsWithProvider */
20-
public function test_starts_with(string $haystack, string $needle, bool $expectedResult)
20+
public function test_starts_with(string $haystack, string $needle, bool $expectedResult): void
2121
{
2222
$this->assertSame($expectedResult, Str::startsWith($haystack, $needle));
2323
}
2424

2525
/** @dataProvider endsWithProvider */
26-
public function test_ends_with(string $haystack, string $needle, bool $expectedResult)
26+
public function test_ends_with(string $haystack, string $needle, bool $expectedResult): void
2727
{
2828
$this->assertSame($expectedResult, Str::endsWith($haystack, $needle));
2929
}
3030

3131
/** @dataProvider containsProvider */
32-
public function test_contains(string $haystack, string $needle, bool $expectedResult)
32+
public function test_contains(string $haystack, string $needle, bool $expectedResult): void
3333
{
3434
$this->assertSame($expectedResult, Str::contains($haystack, $needle));
3535
}
3636

3737
/** @dataProvider prefixProvider */
38-
public function test_prefix($text, string $prefix, string $expectedResult)
38+
public function test_prefix($text, string $prefix, string $expectedResult): void
3939
{
4040
$this->assertSame($expectedResult, Str::prefix($text, $prefix));
4141
}
4242

4343
/** @dataProvider stringifyProvider */
44-
public function test_stringify($value, string $expectedResult)
44+
public function test_stringify($value, string $expectedResult): void
4545
{
4646
$this->assertSame($expectedResult, Str::stringify($value));
4747
}
4848

49-
public function test_format_as_table()
49+
public function test_format_as_table(): void
5050
{
5151
$values = ['key1' => -3.14, 'key3 with long name' => ['a', 'b' => 2], 'key2' => 'aaa'];
5252
$result = <<<TABLE
@@ -58,7 +58,7 @@ public function test_format_as_table()
5858
$this->assertSame($result, Str::formatAsTable($values));
5959
}
6060

61-
public function startsWithProvider()
61+
public function startsWithProvider(): ?\Generator
6262
{
6363
yield ['', '', false];
6464
yield ['abc', '', false];
@@ -71,7 +71,7 @@ public function startsWithProvider()
7171
yield ['<h1>a</> bc', 'a', false];
7272
}
7373

74-
public function endsWithProvider()
74+
public function endsWithProvider(): ?\Generator
7575
{
7676
yield ['', '', true];
7777
yield ['abc', '', false];
@@ -84,7 +84,7 @@ public function endsWithProvider()
8484
yield ['ab <h1>c</>', 'c', false];
8585
}
8686

87-
public function containsProvider()
87+
public function containsProvider(): ?\Generator
8888
{
8989
yield ['', '', false];
9090
yield ['abc', '', false];
@@ -102,15 +102,15 @@ public function containsProvider()
102102
yield ['ab <h1>c</>', 'ab c', false];
103103
}
104104

105-
public function prefixProvider()
105+
public function prefixProvider(): ?\Generator
106106
{
107107
yield ['', '', ''];
108108
yield ['aaa', 'xxx', 'xxxaaa'];
109109
yield ["aaa\nbbb\nccc", 'xxx', "xxxaaa\nxxxbbb\nxxxccc"];
110110
yield [['aaa', 'bbb', 'ccc'], 'xxx', "xxxaaa\nxxxbbb\nxxxccc"];
111111
}
112112

113-
public function stringifyProvider()
113+
public function stringifyProvider(): ?\Generator
114114
{
115115
yield ['', ''];
116116
yield [fopen('php://memory', 'r+'), 'PHP Resource'];

tests/Server/ServerRepositoryTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class ServerRepositoryTest extends TestCase
2020
/** @var ServerRepository */
2121
private $servers;
2222

23-
protected function setUp()
23+
protected function setUp(): void
2424
{
2525
$repository = new ServerRepository();
2626
$repository->add(new Server('host0'));

tests/Server/ServerTest.php

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
class ServerTest extends TestCase
1919
{
2020
/** @dataProvider dsnProvider */
21-
public function test_dsn_parsing(string $dsn, string $expectedHost, ?string $expectedUser, ?int $expectedPort)
21+
public function test_dsn_parsing(string $dsn, string $expectedHost, ?string $expectedUser, ?int $expectedPort): void
2222
{
2323
$server = new Server($dsn);
2424

@@ -27,70 +27,69 @@ public function test_dsn_parsing(string $dsn, string $expectedHost, ?string $exp
2727
$this->assertSame($expectedPort, $server->getPort());
2828
}
2929

30-
/**
31-
* @expectedException \EasyCorp\Bundle\EasyDeployBundle\Exception\ServerConfigurationException
32-
* @expectedExceptionMessage The host is missing (define it as an IP address or a host name)
33-
*/
34-
public function test_dsn_parsing_error()
30+
public function test_dsn_parsing_error(): void
3531
{
32+
$this->expectException(\EasyCorp\Bundle\EasyDeployBundle\Exception\ServerConfigurationException::class);
33+
$this->expectExceptionMessage('The host is missing (define it as an IP address or a host name)');
34+
3635
new Server('deployer@');
3736
}
3837

3938
/** @dataProvider localDsnProvider */
40-
public function test_local_dsn_parsing(string $dsn)
39+
public function test_local_dsn_parsing(string $dsn): void
4140
{
4241
$server = new Server($dsn);
4342

4443
$this->assertTrue($server->isLocalHost());
4544
}
4645

4746
/** @dataProvider sshConnectionStringProvider */
48-
public function test_ssh_connection_string($dsn, $expectedSshConnectionString)
47+
public function test_ssh_connection_string($dsn, $expectedSshConnectionString): void
4948
{
5049
$server = new Server($dsn);
5150

5251
$this->assertSame($expectedSshConnectionString, $server->getSshConnectionString());
5352
}
5453

55-
public function test_ssh_agent_forwarding()
54+
public function test_ssh_agent_forwarding(): void
5655
{
5756
$server = new Server('host');
5857
$server->set(Property::use_ssh_agent_forwarding, true);
5958

6059
$this->assertSame('ssh -A host', $server->getSshConnectionString());
6160
}
6261

63-
public function test_default_server_roles()
62+
public function test_default_server_roles(): void
6463
{
6564
$server = new Server('host');
6665

6766
$this->assertSame([Server::ROLE_APP], $server->getRoles());
6867
}
6968

7069
/** @dataProvider serverRolesProvider */
71-
public function test_server_roles(array $definedRoles, array $expectedRoles)
70+
public function test_server_roles(array $definedRoles, array $expectedRoles): void
7271
{
7372
$server = new Server('host', $definedRoles);
7473

7574
$this->assertSame($expectedRoles, $server->getRoles());
7675
}
7776

78-
public function test_default_server_properties()
77+
public function test_default_server_properties(): void
7978
{
8079
$server = new Server('host');
8180

8281
$this->assertSame([], $server->getProperties());
8382
}
8483

85-
public function test_server_properties()
84+
public function test_server_properties(): void
8685
{
8786
$properties = ['prop1' => -3.14, 'prop2' => false, 'prop3' => 'Lorem Ipsum', 'prop4' => ['foo' => 'bar']];
8887
$server = new Server('host', [], $properties);
8988

9089
$this->assertSame($properties, $server->getProperties());
9190
}
9291

93-
public function test_get_set_has_server_properties()
92+
public function test_get_set_has_server_properties(): void
9493
{
9594
$properties = ['prop1' => -3.14, 'prop2' => false, 'prop3' => 'Lorem Ipsum', 'prop4' => ['foo' => 'bar']];
9695
$server = new Server('host');
@@ -106,7 +105,7 @@ public function test_get_set_has_server_properties()
106105
}
107106

108107
/** @dataProvider expressionProvider */
109-
public function test_resolve_properties(array $properties, string $expression, string $expectedExpression)
108+
public function test_resolve_properties(array $properties, string $expression, string $expectedExpression): void
110109
{
111110
$server = new Server('host', [], $properties);
112111

@@ -115,16 +114,16 @@ public function test_resolve_properties(array $properties, string $expression, s
115114

116115
/**
117116
* @dataProvider wrongExpressionProvider
118-
* @expectedException \InvalidArgumentException
119-
* @expectedExceptionMessageRegExp /The ".*" property in ".*" expression is not a valid server property./
120117
*/
121-
public function test_resolve_unknown_properties(array $properties, string $expression)
118+
public function test_resolve_unknown_properties(array $properties, string $expression): void
122119
{
120+
$this->expectException(\InvalidArgumentException::class);
121+
$this->expectExceptionMessageMatches('/The ".*" property in ".*" expression is not a valid server property./');
123122
$server = new Server('host', [], $properties);
124123
$server->resolveProperties($expression);
125124
}
126125

127-
public function dsnProvider()
126+
public function dsnProvider(): ?\Generator
128127
{
129128
yield ['123.123.123.123', '123.123.123.123', null, null];
130129
yield ['[email protected]', '123.123.123.123', 'deployer', null];
@@ -143,7 +142,7 @@ public function dsnProvider()
143142
yield ['ssh://deployer@host:22001', 'host', 'deployer', 22001];
144143
}
145144

146-
public function localDsnProvider()
145+
public function localDsnProvider(): ?\Generator
147146
{
148147
yield ['local'];
149148
yield ['deployer@local'];
@@ -158,23 +157,23 @@ public function localDsnProvider()
158157
yield ['[email protected]:22001'];
159158
}
160159

161-
public function serverRolesProvider()
160+
public function serverRolesProvider(): ?\Generator
162161
{
163162
yield [[], []];
164163
yield [[Server::ROLE_APP], [Server::ROLE_APP]];
165164
yield [['custom_role'], ['custom_role']];
166165
yield [['custom_role_1', 'custom_role_2'], ['custom_role_1', 'custom_role_2']];
167166
}
168167

169-
public function sshConnectionStringProvider()
168+
public function sshConnectionStringProvider(): ?\Generator
170169
{
171170
yield ['localhost', ''];
172171
yield ['123.123.123.123', 'ssh 123.123.123.123'];
173172
174173
yield ['[email protected]:22001', 'ssh [email protected] -p 22001'];
175174
}
176175

177-
public function expressionProvider()
176+
public function expressionProvider(): ?\Generator
178177
{
179178
yield [['prop1' => 'aaa'], '{{ prop1 }}', 'aaa'];
180179
yield [['prop.1' => 'aaa'], '{{ prop.1 }}', 'aaa'];
@@ -188,7 +187,7 @@ public function expressionProvider()
188187
yield [['prop1' => 'aaa', 'prop2' => 'bbb'], 'cd {{ prop1 }}{{ prop2 }}', 'cd aaabbb'];
189188
}
190189

191-
public function wrongExpressionProvider()
190+
public function wrongExpressionProvider(): ?\Generator
192191
{
193192
yield [[], '{{ prop1 }}'];
194193
yield [['prop1' => 'aaa'], '{{ prop 1 }}'];

tests/Task/TaskCompletedTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,23 +17,23 @@
1717

1818
class TaskCompletedTest extends TestCase
1919
{
20-
public function test_server()
20+
public function test_server(): void
2121
{
2222
$result = new TaskCompleted(new Server('deployer@host1'), 'aaa', 0);
2323

2424
$this->assertSame('deployer', $result->getServer()->getUser());
2525
$this->assertSame('host1', $result->getServer()->getHost());
2626
}
2727

28-
public function test_output()
28+
public function test_output(): void
2929
{
3030
$result = new TaskCompleted(new Server('localhost'), 'aaa ', 0);
3131

3232
$this->assertSame('aaa ', $result->getOutput());
3333
$this->assertSame('aaa', $result->getTrimmedOutput());
3434
}
3535

36-
public function test_exit_code()
36+
public function test_exit_code(): void
3737
{
3838
$result = new TaskCompleted(new Server('localhost'), 'aaa', -1);
3939

0 commit comments

Comments
 (0)