forked from EasyCorp/easy-deploy-bundle
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
composer: allow Symfony6 + phpunit upgrade
- Loading branch information
Showing
8 changed files
with
62 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
vendor/* | ||
.phpunit.result.cache | ||
composer.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,7 @@ | |
class ServerTest extends TestCase | ||
{ | ||
/** @dataProvider dsnProvider */ | ||
public function test_dsn_parsing(string $dsn, string $expectedHost, ?string $expectedUser, ?int $expectedPort) | ||
public function test_dsn_parsing(string $dsn, string $expectedHost, ?string $expectedUser, ?int $expectedPort): void | ||
{ | ||
$server = new Server($dsn); | ||
|
||
|
@@ -27,70 +27,69 @@ public function test_dsn_parsing(string $dsn, string $expectedHost, ?string $exp | |
$this->assertSame($expectedPort, $server->getPort()); | ||
} | ||
|
||
/** | ||
* @expectedException \EasyCorp\Bundle\EasyDeployBundle\Exception\ServerConfigurationException | ||
* @expectedExceptionMessage The host is missing (define it as an IP address or a host name) | ||
*/ | ||
public function test_dsn_parsing_error() | ||
public function test_dsn_parsing_error(): void | ||
{ | ||
$this->expectException(\EasyCorp\Bundle\EasyDeployBundle\Exception\ServerConfigurationException::class); | ||
$this->expectExceptionMessage('The host is missing (define it as an IP address or a host name)'); | ||
|
||
new Server('deployer@'); | ||
} | ||
|
||
/** @dataProvider localDsnProvider */ | ||
public function test_local_dsn_parsing(string $dsn) | ||
public function test_local_dsn_parsing(string $dsn): void | ||
{ | ||
$server = new Server($dsn); | ||
|
||
$this->assertTrue($server->isLocalHost()); | ||
} | ||
|
||
/** @dataProvider sshConnectionStringProvider */ | ||
public function test_ssh_connection_string($dsn, $expectedSshConnectionString) | ||
public function test_ssh_connection_string($dsn, $expectedSshConnectionString): void | ||
{ | ||
$server = new Server($dsn); | ||
|
||
$this->assertSame($expectedSshConnectionString, $server->getSshConnectionString()); | ||
} | ||
|
||
public function test_ssh_agent_forwarding() | ||
public function test_ssh_agent_forwarding(): void | ||
{ | ||
$server = new Server('host'); | ||
$server->set(Property::use_ssh_agent_forwarding, true); | ||
|
||
$this->assertSame('ssh -A host', $server->getSshConnectionString()); | ||
} | ||
|
||
public function test_default_server_roles() | ||
public function test_default_server_roles(): void | ||
{ | ||
$server = new Server('host'); | ||
|
||
$this->assertSame([Server::ROLE_APP], $server->getRoles()); | ||
} | ||
|
||
/** @dataProvider serverRolesProvider */ | ||
public function test_server_roles(array $definedRoles, array $expectedRoles) | ||
public function test_server_roles(array $definedRoles, array $expectedRoles): void | ||
{ | ||
$server = new Server('host', $definedRoles); | ||
|
||
$this->assertSame($expectedRoles, $server->getRoles()); | ||
} | ||
|
||
public function test_default_server_properties() | ||
public function test_default_server_properties(): void | ||
{ | ||
$server = new Server('host'); | ||
|
||
$this->assertSame([], $server->getProperties()); | ||
} | ||
|
||
public function test_server_properties() | ||
public function test_server_properties(): void | ||
{ | ||
$properties = ['prop1' => -3.14, 'prop2' => false, 'prop3' => 'Lorem Ipsum', 'prop4' => ['foo' => 'bar']]; | ||
$server = new Server('host', [], $properties); | ||
|
||
$this->assertSame($properties, $server->getProperties()); | ||
} | ||
|
||
public function test_get_set_has_server_properties() | ||
public function test_get_set_has_server_properties(): void | ||
{ | ||
$properties = ['prop1' => -3.14, 'prop2' => false, 'prop3' => 'Lorem Ipsum', 'prop4' => ['foo' => 'bar']]; | ||
$server = new Server('host'); | ||
|
@@ -106,7 +105,7 @@ public function test_get_set_has_server_properties() | |
} | ||
|
||
/** @dataProvider expressionProvider */ | ||
public function test_resolve_properties(array $properties, string $expression, string $expectedExpression) | ||
public function test_resolve_properties(array $properties, string $expression, string $expectedExpression): void | ||
{ | ||
$server = new Server('host', [], $properties); | ||
|
||
|
@@ -115,16 +114,16 @@ public function test_resolve_properties(array $properties, string $expression, s | |
|
||
/** | ||
* @dataProvider wrongExpressionProvider | ||
* @expectedException \InvalidArgumentException | ||
* @expectedExceptionMessageRegExp /The ".*" property in ".*" expression is not a valid server property./ | ||
*/ | ||
public function test_resolve_unknown_properties(array $properties, string $expression) | ||
public function test_resolve_unknown_properties(array $properties, string $expression): void | ||
{ | ||
$this->expectException(\InvalidArgumentException::class); | ||
$this->expectExceptionMessageMatches('/The ".*" property in ".*" expression is not a valid server property./'); | ||
$server = new Server('host', [], $properties); | ||
$server->resolveProperties($expression); | ||
} | ||
|
||
public function dsnProvider() | ||
public function dsnProvider(): ?\Generator | ||
{ | ||
yield ['123.123.123.123', '123.123.123.123', null, null]; | ||
yield ['[email protected]', '123.123.123.123', 'deployer', null]; | ||
|
@@ -143,7 +142,7 @@ public function dsnProvider() | |
yield ['ssh://deployer@host:22001', 'host', 'deployer', 22001]; | ||
} | ||
|
||
public function localDsnProvider() | ||
public function localDsnProvider(): ?\Generator | ||
{ | ||
yield ['local']; | ||
yield ['deployer@local']; | ||
|
@@ -158,23 +157,23 @@ public function localDsnProvider() | |
yield ['[email protected]:22001']; | ||
} | ||
|
||
public function serverRolesProvider() | ||
public function serverRolesProvider(): ?\Generator | ||
{ | ||
yield [[], []]; | ||
yield [[Server::ROLE_APP], [Server::ROLE_APP]]; | ||
yield [['custom_role'], ['custom_role']]; | ||
yield [['custom_role_1', 'custom_role_2'], ['custom_role_1', 'custom_role_2']]; | ||
} | ||
|
||
public function sshConnectionStringProvider() | ||
public function sshConnectionStringProvider(): ?\Generator | ||
{ | ||
yield ['localhost', '']; | ||
yield ['123.123.123.123', 'ssh 123.123.123.123']; | ||
yield ['[email protected]', 'ssh [email protected]']; | ||
yield ['[email protected]:22001', 'ssh [email protected] -p 22001']; | ||
} | ||
|
||
public function expressionProvider() | ||
public function expressionProvider(): ?\Generator | ||
{ | ||
yield [['prop1' => 'aaa'], '{{ prop1 }}', 'aaa']; | ||
yield [['prop.1' => 'aaa'], '{{ prop.1 }}', 'aaa']; | ||
|
@@ -188,7 +187,7 @@ public function expressionProvider() | |
yield [['prop1' => 'aaa', 'prop2' => 'bbb'], 'cd {{ prop1 }}{{ prop2 }}', 'cd aaabbb']; | ||
} | ||
|
||
public function wrongExpressionProvider() | ||
public function wrongExpressionProvider(): ?\Generator | ||
{ | ||
yield [[], '{{ prop1 }}']; | ||
yield [['prop1' => 'aaa'], '{{ prop 1 }}']; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters