Skip to content

Commit

Permalink
MAGECLOUD-3649: Rewrite Patch/ApplierTest to use Cloud Docker (magent…
Browse files Browse the repository at this point in the history
  • Loading branch information
BaDos authored and shiftedreality committed May 21, 2019
1 parent c51e01c commit 4342f9f
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 104 deletions.
61 changes: 61 additions & 0 deletions src/Test/Functional/Acceptance/PatchApplierCest.php
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')
);
}
}
104 changes: 0 additions & 104 deletions src/Test/Integration/Patch/ApplierTest.php

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Hello Magento

## Additional Info

0 comments on commit 4342f9f

Please sign in to comment.