Skip to content

Commit

Permalink
Add e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
reimic committed Mar 25, 2024
1 parent e61678b commit 805f1ef
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace WordPress\Blueprints\Runner\Step;

use PHPUnit\Exception;
use WordPress\Blueprints\Model\DataClass\RunWordPressInstallerStep;
use WordPress\Blueprints\Progress\Tracker;

Expand All @@ -11,22 +12,28 @@ class RunWordPressInstallerStepRunner extends BaseStepRunner {
* @param \WordPress\Blueprints\Progress\Tracker $tracker
*/
function run( $input, $tracker ) {
$result = $this->getRuntime()->runShellCommand(
array(
'php',
'wp-cli.phar',
'--allow-root',
'core',
'install',
'--url=http://localhost:8081',
'--title=Playground Site',
'--admin_user=' . $input->options->adminUsername,
'--admin_password=' . $input->options->adminPassword,
'[email protected]',
),
$this->getRuntime()->getDocumentRoot()
);
return trim( $result );
var_dump( $input );
try {
$result = $this->getRuntime()->runShellCommand(
array(
'php',
'wp-cli.phar',
'--allow-root',
'core',
'install',
'--url=http://localhost:8081',
'--title=Playground Site',
'--admin_user=' . $input->options->adminUsername,
'--admin_password=' . $input->options->adminPassword,
'[email protected]',
),
$this->getRuntime()->getDocumentRoot()
);
return trim( $result );
} catch ( Exception $exception ) {
var_dump( $exception );
}
return null;
}

public function getDefaultCaption( $input ) {
Expand Down
4 changes: 4 additions & 0 deletions tests/e2e/PhpBlueprintTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@ public function testRunningPhpBlueprintWithWordPressVersion() {
3 => new StepSuccess( $run_word_press_installer_step, 'Success: WordPress installed successfully.' )
);

// - 'result' => 'Success: WordPress installed successfully.'
// + 'result' => '#!/usr/bin/env php\n
// + Success: WordPress installed successfully.'

//@TODO Assert WP files exist

self::assertEquals( $expected, $results );
Expand Down

0 comments on commit 805f1ef

Please sign in to comment.