-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow passing the file to docker-compose.yml and any other docker-com…
…pose arguments (#39)
- Loading branch information
1 parent
2c1fd13
commit 4849ce2
Showing
4 changed files
with
126 additions
and
1 deletion.
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
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 |
---|---|---|
@@ -0,0 +1,74 @@ | ||
<?php | ||
|
||
namespace Consolidation\SiteProcess; | ||
|
||
use Consolidation\SiteProcess\Transport\DockerComposeTransport; | ||
use PHPUnit\Framework\TestCase; | ||
use Consolidation\SiteAlias\SiteAlias; | ||
|
||
class DockerComposeTransportTest extends TestCase | ||
{ | ||
/** | ||
* Data provider for testWrap. | ||
*/ | ||
public function wrapTestValues() | ||
{ | ||
return [ | ||
[ | ||
'docker-compose --project project --project-directory projectDir --file myCompose.yml exec -T --user root drupal ls', | ||
[ | ||
'docker' => [ | ||
'service' => 'drupal', | ||
'compose' => [ | ||
'options' => '--project project --project-directory projectDir --file myCompose.yml' | ||
], | ||
'exec' => ['options' => '--user root'] | ||
] | ||
], | ||
], | ||
[ | ||
'docker-compose exec -T drupal ls', | ||
[ | ||
'docker' => [ | ||
'service' => 'drupal', | ||
] | ||
], | ||
], | ||
[ | ||
'docker-compose --project project2 --file myCompose.yml exec -T drupal ls', | ||
[ | ||
'docker' => [ | ||
'service' => 'drupal', | ||
'project' => 'project1', | ||
'compose' => [ | ||
'options' => '--project project2 --file myCompose.yml' | ||
] | ||
] | ||
], | ||
], | ||
[ | ||
'docker-compose -p project1 --file myCompose.yml exec -T drupal ls', | ||
[ | ||
'docker' => [ | ||
'service' => 'drupal', | ||
'project' => 'project1', | ||
'compose' => [ | ||
'options' => '--file myCompose.yml' | ||
] | ||
] | ||
], | ||
], | ||
]; | ||
} | ||
|
||
/** | ||
* @dataProvider wrapTestValues | ||
*/ | ||
public function testWrap($expected, $siteAliasData) | ||
{ | ||
$siteAlias = new SiteAlias($siteAliasData, '@alias.dev'); | ||
$dockerTransport = new DockerComposeTransport($siteAlias); | ||
$actual = $dockerTransport->wrap(['ls']); | ||
$this->assertEquals($expected, implode(' ', $actual)); | ||
} | ||
} |