Skip to content

Commit

Permalink
Merge pull request pantheon-systems#2165 from pantheon-systems/v3.0-f…
Browse files Browse the repository at this point in the history
…unctional-tests-lock-commands

v3.0 Add Lock commands functional tests
  • Loading branch information
stovak authored Aug 2, 2021
2 parents 799e442 + 9b5585c commit cf968e9
Showing 1 changed file with 42 additions and 6 deletions.
48 changes: 42 additions & 6 deletions tests/Functional/LockCommandsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
namespace Pantheon\Terminus\Tests\Functional;

use Pantheon\Terminus\Tests\Traits\LoginHelperTrait;
use Pantheon\Terminus\Tests\Traits\SiteBaseSetupTrait;
use Pantheon\Terminus\Tests\Traits\TerminusTestTrait;
use Pantheon\Terminus\Tests\Traits\UrlStatusCodeHelperTrait;
use PHPUnit\Framework\TestCase;

/**
Expand All @@ -24,11 +22,49 @@ class LockCommandsTest extends TestCase
* @covers \Pantheon\Terminus\Commands\Lock\EnableCommand
* @covers \Pantheon\Terminus\Commands\Lock\InfoCommand
*
* @group branch
* @group long
* @group lock
* @group short
*
* @throws \Exception
*/
public function testBranchList()
public function testLockCommands()
{
$this->fail("To Be Written");
// Disable the lock if set.
$disableLockCommand = sprintf('lock:disable %s.%s', $this->getSiteName(), 'dev');
$this->terminus($disableLockCommand);

// Verify the lock is disabled.
$getLockInfoCommand = sprintf('lock:info %s.%s ', $this->getSiteName(), 'dev');
$lockInfo = $this->terminusJsonResponse($getLockInfoCommand);
$expectedLockInfo = [
'locked' => false,
'username' => null,
'password' => null,
];
$this->assertEquals($expectedLockInfo, $lockInfo);

// Enable the lock.
$lockUserName = 'test_user';
$lockPassword = 'test_password';
$enableLockInfoCommand = sprintf(
'lock:enable %s.%s %s %s',
$this->getSiteName(),
'dev',
$lockUserName,
$lockPassword
);
$this->terminus($enableLockInfoCommand);

// Verify the lock is enabled.
$lockInfo = $this->terminusJsonResponse($getLockInfoCommand);
$expectedLockInfo = [
'locked' => true,
'username' => $lockUserName,
'password' => $lockPassword,
];
$this->assertEquals($expectedLockInfo, $lockInfo);

// Disable the lock.
$this->terminus($disableLockCommand);
}
}

0 comments on commit cf968e9

Please sign in to comment.