forked from magento/ece-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MAGECLOUD-3649: Rewrite Patch/ApplierTest to use Cloud Docker (magent…
- Loading branch information
1 parent
c51e01c
commit 4342f9f
Showing
5 changed files
with
64 additions
and
104 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,61 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Magento\MagentoCloud\Test\Functional\Acceptance; | ||
|
||
use Magento\MagentoCloud\Test\Functional\Codeception\Docker; | ||
|
||
/** | ||
* @group php72 | ||
*/ | ||
class PatchApplierCest | ||
{ | ||
/** | ||
* @param \CliTester $I | ||
* @throws \Robo\Exception\TaskException | ||
*/ | ||
public function testApplyingPatch(\CliTester $I) | ||
{ | ||
$I->assertTrue($I->cloneTemplate()); | ||
$I->assertTrue($I->composerInstall()); | ||
$I->uploadToContainer('files/patches/target_file.md', '/target_file.md', Docker::BUILD_CONTAINER); | ||
$I->uploadToContainer('files/patches/patch.patch', '/m2-hotfixes/patch.patch', Docker::BUILD_CONTAINER); | ||
|
||
// For this test, only the build phase is enough | ||
$I->assertTrue($I->runEceToolsCommand('build', Docker::BUILD_CONTAINER)); | ||
|
||
$targetFile = $I->grabFileContent('/target_file.md'); | ||
$I->assertContains('# Hello Magento', $targetFile); | ||
$I->assertContains('## Additional Info', $targetFile); | ||
$log = $I->grabFileContent('/var/log/cloud.log'); | ||
$I->assertContains('INFO: Applying patch /var/www/magento/m2-hotfixes/patch.patch', $log); | ||
$I->assertContains('INFO: git apply /var/www/magento/m2-hotfixes/patch.patch', $log); | ||
} | ||
|
||
/** | ||
* @param \CliTester $I | ||
* @throws \Robo\Exception\TaskException | ||
*/ | ||
public function testApplyingExistingPatch(\CliTester $I) | ||
{ | ||
$I->assertTrue($I->cloneTemplate()); | ||
$I->assertTrue($I->composerInstall()); | ||
$I->uploadToContainer('files/patches/target_file_applied_patch.md', '/target_file.md', Docker::BUILD_CONTAINER); | ||
$I->uploadToContainer('files/patches/patch.patch', '/m2-hotfixes/patch.patch', Docker::BUILD_CONTAINER); | ||
|
||
// For this test, only the build phase is enough | ||
$I->assertTrue($I->runEceToolsCommand('build', Docker::BUILD_CONTAINER)); | ||
|
||
$targetFile = $I->grabFileContent('/target_file.md'); | ||
$I->assertContains('# Hello Magento', $targetFile); | ||
$I->assertContains('## Additional Info', $targetFile); | ||
$I->assertContains( | ||
'Patch /var/www/magento/m2-hotfixes/patch.patch was already applied', | ||
$I->grabFileContent('/var/log/cloud.log') | ||
); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
3 changes: 3 additions & 0 deletions
3
tests/functional/_data/files/patches/target_file_applied_patch.md
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 @@ | ||
# Hello Magento | ||
|
||
## Additional Info |