Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v3.0 Add Lock commands functional tests #2165

Merged
merged 1 commit into from
Aug 2, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
}
}