Skip to content

Commit

Permalink
Add basic tests for commands
Browse files Browse the repository at this point in the history
  • Loading branch information
cweagans committed Feb 7, 2023
1 parent 5ecb0d9 commit eaa8ee7
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
28 changes: 28 additions & 0 deletions tests/_data/fixtures/commands/composer.json
@@ -0,0 +1,28 @@
{
"name": "cweagans/composer-patches-test-project",
"description": "Project for use in cweagans/composer-patches acceptance tests.",
"type": "project",
"license": "BSD-3-Clause",
"repositories": [
{
"type": "path",
"url": "../../../../"
}
],
"require": {
"cweagans/composer-patches": "*@dev",
"cweagans/composer-patches-testrepo": "~1.0"
},
"extra": {
"patches": {
"cweagans/composer-patches-testrepo": {
"Add a file": "https://patch-diff.githubusercontent.com/raw/cweagans/composer-patches-testrepo/pull/1.patch"
}
}
},
"config": {
"allow-plugins": {
"cweagans/composer-patches": true
}
}
}
24 changes: 24 additions & 0 deletions tests/acceptance/CommandsCept.php
@@ -0,0 +1,24 @@
<?php

/**
* @var \Codeception\Scenario $scenario
*/

use cweagans\Composer\Tests\AcceptanceTester;

$I = new AcceptanceTester($scenario);
$I->wantTo('use composer commands to repatch and relock patch data');
$I->amInPath(codecept_data_dir('fixtures/commands'));
$I->runComposerCommand('install', ['-vvv']);

$I->openFile('patches.lock');
$I->seeInThisFile('725f2631cb6a92c8c3ffc2e396e89f73b726869131d4c4d2a5903aae6854a260');

$I->runShellCommand('composer patches-relock');
$I->openFile('patches.lock');
$I->seeInThisFile('725f2631cb6a92c8c3ffc2e396e89f73b726869131d4c4d2a5903aae6854a260');

$I->runShellCommand('composer patches-repatch 2>&1');
$I->canSeeInShellOutput('Removing cweagans/composer-patches-testrepo');
$I->canSeeInShellOutput('Installing cweagans/composer-patches-testrepo');
$I->canSeeInShellOutput('Patching cweagans/composer-patches-testrepo');

0 comments on commit eaa8ee7

Please sign in to comment.