Refactored InstallCommand (+ removed localization from InstallCommand, because it doesn't works actually)

This commit is contained in:
Dmitry Khomutov 2017-02-04 17:34:19 +07:00
commit 0a4636a379
No known key found for this signature in database
GPG key ID: 7EB36C9576F9ECB9
22 changed files with 198 additions and 695 deletions

View file

@ -1,13 +1,5 @@
<?php
/**
* PHPCI - Continuous Integration for PHP
*
* @copyright Copyright 2015, Block 8 Limited.
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
* @link https://www.phptesting.org/
*/
namespace Tests\PHPCensor\Plugin\Command;
use Symfony\Component\Console\Application;
@ -17,6 +9,7 @@ use Symfony\Component\Console\Helper\HelperSet;
class InstallCommandTest extends \PHPUnit_Framework_TestCase
{
public $config;
public $admin;
/**
@ -101,11 +94,11 @@ class InstallCommandTest extends \PHPUnit_Framework_TestCase
'--db-port' => '3306',
'--db-name' => 'php-censor-db',
'--db-user' => 'php-censor-user',
'--db-pass' => 'php-censor-password',
'--db-password' => 'php-censor-password',
'--db-type' => 'mysql',
'--admin-mail' => 'admin@php-censor.local',
'--admin-email' => 'admin@php-censor.local',
'--admin-name' => 'admin',
'--admin-pass' => 'admin-password',
'--admin-password' => 'admin-password',
'--url' => 'http://php-censor.local',
'--queue-use' => null,
];
@ -125,7 +118,7 @@ class InstallCommandTest extends \PHPUnit_Framework_TestCase
// Get tester and execute with extracted parameters.
$commandTester = $this->getCommandTester($dialog);
$parameters = $this->getConfig($param);
$parameters = $this->getConfig($param);
$commandTester->execute($parameters);
}
@ -183,7 +176,7 @@ class InstallCommandTest extends \PHPUnit_Framework_TestCase
$dialog->expects($this->once())->method('ask')->willReturn('testedvalue');
$this->executeWithoutParam('--db-pass', $dialog);
$this->executeWithoutParam('--db-password', $dialog);
// Check that specified arguments are correctly loaded.
$this->assertEquals('testedvalue', $this->config['b8']['database']['password']);
@ -209,10 +202,10 @@ class InstallCommandTest extends \PHPUnit_Framework_TestCase
// We specified an input value for hostname.
$dialog->expects($this->once())->method('ask')->willReturn('admin@php-censor.local');
$this->executeWithoutParam('--admin-mail', $dialog);
$this->executeWithoutParam('--admin-email', $dialog);
// Check that specified arguments are correctly loaded.
$this->assertEquals('admin@php-censor.local', $this->admin['mail']);
$this->assertEquals('admin@php-censor.local', $this->admin['email']);
}
public function testAdminNameConfig()
@ -235,9 +228,9 @@ class InstallCommandTest extends \PHPUnit_Framework_TestCase
// We specified an input value for hostname.
$dialog->expects($this->once())->method('ask')->willReturn('testedvalue');
$this->executeWithoutParam('--admin-pass', $dialog);
$this->executeWithoutParam('--admin-password', $dialog);
// Check that specified arguments are correctly loaded.
$this->assertEquals('testedvalue', $this->admin['pass']);
$this->assertEquals('testedvalue', $this->admin['password']);
}
}