Esempio n. 1
0
 /**
  * @expectedException        \Terminus\Exceptions\TerminusException
  * @expectedExceptionMessage Authorization failed
  */
 public function testLogInViaUsernameAndPassword()
 {
     $creds = getBehatCredentials();
     $this->assertTrue($this->auth->logInViaUsernameAndPassword($creds['username'], $creds['password']));
     $this->auth->logInViaUsernameAndPassword('invalid', 'password');
     setDummyCredentials();
 }
Esempio n. 2
0
 public function testGetCache()
 {
     setDummyCredentials();
     $cache = Terminus::getCache();
     setDummyCredentials();
     $session = $cache->getData('session');
     $this->assertEquals($session->user_uuid, '0ffec038-4410-43d0-a404-46997f672d7a');
 }
Esempio n. 3
0
 /**
  * @vcr site_deploy
  */
 public function testGetParentEnvironment()
 {
     logInWithBehatCredentials();
     $site = $this->sites->get('behat-tests');
     $test_env = $site->environments->get('test');
     $dev_env = $test_env->getParentEnvironment();
     $this->assertEquals($dev_env->get('id'), 'dev');
     setDummyCredentials();
 }
Esempio n. 4
0
 public function testSetData()
 {
     $this->assertFalse($this->session->setData([]));
     $proverb[] = 'Be humble for you are made of earth. ';
     $proverb[] = 'Be noble for you are made of stars.';
     $this->assertTrue(Session::setData($proverb));
     $data = (array) Session::getData();
     $this->assertEquals(array_pop($data), $proverb[1]);
     setDummyCredentials();
 }
Esempio n. 5
0
$_SERVER['TERMINUS_LOG_DIR'] = '/tmp/';
define('CLI_ROOT', dirname(__DIR__) . '/..');
define('TEST_DIR', dirname(__DIR__));
define('TERMINUS_CMD', 'php ' . CLI_ROOT . '/php/boot-fs.php');
putenv('CLI_TEST_MODE=1');
require_once CLI_ROOT . '/vendor/autoload.php';
require_once CLI_ROOT . '/php/boot-fs.php';
$runner = new \Terminus\Runner(array('debug' => false));
use Terminus\Commands\ArtCommand;
use Terminus\Exceptions\TerminusException;
use Terminus\Helpers\AuthHelper;
use Terminus\Loggers\Logger;
use Terminus\Runner;
use Terminus\Session;
\VCR\VCR::configure()->enableRequestMatchers(array('method', 'url', 'body'));
setDummyCredentials();
// Prevent API requests from being made in CI Environment
$ci_environment = getenv('CI');
if ($ci_environment) {
    \VCR\VCR::configure()->setMode('none');
}
$output_file_name = '/tmp/output';
$moved_file_suffix = 'testmoved';
setTerminusOutputter($output_file_name);
/**
 * Returns the username and password for Behat fixtures
 *
 * @return string[]
 */
function getBehatCredentials()
{