Skip to content

Commit

Permalink
ACMS-1925: Added starter kit unit tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
deepakmishra2 committed Aug 11, 2023
1 parent 14dfe4b commit 93393db
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
20 changes: 19 additions & 1 deletion tests/unit/CliTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace tests;

use AcquiaCMS\Cli\Cli;
use AcquiaCMS\Cli\Validation\StarterKitValidation;
use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;
use Symfony\Component\Console\Output\OutputInterface;
Expand Down Expand Up @@ -39,6 +40,13 @@ class CliTest extends TestCase {
*/
protected $acquiaCli;

/**
* Starter-kit validator.
*
* @var \AcquiaCMS\Cli\Validation\StarterKitValidation
*/
protected $starterKitValidation;

/**
* {@inheritdoc}
*/
Expand All @@ -48,7 +56,8 @@ protected function setUp(): void {
$this->projectDirectory = getcwd();
$this->rootDirectory = $this->projectDirectory;
$container = $this->createMock('Symfony\Component\DependencyInjection\ContainerInterface');
$this->acquiaCli = new Cli($this->projectDirectory, $this->rootDirectory, $output, $container);
$this->starterKitValidation = new StarterKitValidation($output);
$this->acquiaCli = new Cli($this->projectDirectory, $this->rootDirectory, $output, $container, $this->starterKitValidation);
}

/**
Expand All @@ -62,6 +71,15 @@ public function testExecute() :void {
$this->assertEquals($this->getAcmsFileContents(), $this->acquiaCli->getAcquiaCmsFile($this->projectDirectory . '/acms/acms.yml'));
}

/**
* Tests starter-kit validation.
*/
public function testValidateStarterKit(): void {
$starterKit = $this->getAcmsFileContents()['starter_kits'];
$output = $this->starterKitValidation->validateStarterKit($starterKit);
$this->assertIsArray($output);
}

/**
* @dataProvider alterModuleThemesDataProvider
*/
Expand Down
11 changes: 10 additions & 1 deletion tests/unit/Helpers/InstallerQuestionsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use AcquiaCMS\Cli\Cli;
use AcquiaCMS\Cli\Helpers\InstallerQuestions;
use AcquiaCMS\Cli\Validation\StarterKitValidation;
use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;
use Symfony\Component\Console\Output\OutputInterface;
Expand Down Expand Up @@ -72,6 +73,13 @@ class InstallerQuestionsTest extends TestCase {
*/
protected $acmsInstallQuestions;

/**
* Starter-kit validator.
*
* @var \AcquiaCMS\Cli\Validation\StarterKitValidation
*/
protected $starterKitValidation;

/**
* {@inheritdoc}
*/
Expand All @@ -81,7 +89,8 @@ protected function setUp(): void {
$this->projectDirectory = getcwd();
$this->rootDirectory = $this->projectDirectory;
$container = $this->createMock('Symfony\Component\DependencyInjection\ContainerInterface');
$this->acquiaCli = new Cli($this->projectDirectory, $this->rootDirectory, $output, $container);
$this->starterKitValidation = new StarterKitValidation($output);
$this->acquiaCli = new Cli($this->projectDirectory, $this->rootDirectory, $output, $container, $this->starterKitValidation);
$this->installerQuestions = new InstallerQuestions();
$this->acmsBuildQuestions = $this->acquiaCli->getInstallerQuestions('build');
$this->acmsInstallQuestions = $this->acquiaCli->getInstallerQuestions('install');
Expand Down

0 comments on commit 93393db

Please sign in to comment.