Skip to content
This repository was archived by the owner on Mar 5, 2025. It is now read-only.

Commit 510a45d

Browse files
committed
Improving validation.
1 parent 4ae3e15 commit 510a45d

File tree

4 files changed

+14
-9
lines changed

4 files changed

+14
-9
lines changed

src/Robo/Commands/Tests/BehatCommand.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public function initialize() {
7979
* @interactConfigureBehat
8080
* @validateMySqlAvailable
8181
* @validateDrupalIsInstalled
82-
* @validateHashSaltIsPresent
82+
* @validateSettingsFilesPresent
8383
* @validateBehatIsConfigured
8484
* @validateInsideVm
8585
* @launchWebServer
@@ -168,6 +168,7 @@ protected function launchSelenium() {
168168
->get('executor')
169169
->execute($this->getConfigValue('composer.bin') . "/selenium-server-standalone -port {$this->seleniumPort} -log {$this->seleniumLogFile} > /dev/null 2>&1")
170170
->background(TRUE)
171+
// @todo Print output when this command fails.
171172
->printOutput(TRUE)
172173
->dir($this->getConfigValue('repo.root'))
173174
->run();

src/Robo/Common/Executor.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace Acquia\Blt\Robo\Common;
44

55
use Acquia\Blt\Robo\Config\ConfigAwareTrait;
6+
use Acquia\Blt\Robo\Exceptions\BltException;
67
use GuzzleHttp\Client;
78
use Psr\Log\LoggerAwareInterface;
89
use Psr\Log\LoggerAwareTrait;
@@ -189,7 +190,7 @@ public function wait(callable $callable, array $args, $message = '') {
189190
usleep($checkEvery * 1000);
190191
}
191192

192-
throw new BltException("Timed out");
193+
throw new BltException("Timed out.");
193194
}
194195

195196
/**

src/Robo/Hooks/ValidateHook.php

+9-7
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,7 @@ public function validateDrupalIsInstalled(CommandData $commandData) {
7474
* @hook validate @validateSettingsFileIsValid
7575
*/
7676
public function validateSettingsFileIsValid(CommandData $commandData) {
77-
if (!$this->getInspector()
78-
->isDrupalSettingsFilePresent()
79-
) {
77+
if (!$this->getInspector()->isDrupalSettingsFilePresent()) {
8078
throw new BltException("Could not find settings.php for this site.");
8179
}
8280

@@ -107,16 +105,20 @@ public function validateMySqlAvailable() {
107105
throw new BltException("MySql is not available. Please run `blt doctor` to diagnose the issue.");
108106
}
109107
}
108+
110109
/**
111-
* Validates that salt.txt exists.
110+
* Validates that required settings files exist.
112111
*
113-
* @hook validate @validateHashSaltIsPresent
112+
* @hook validate @validateSettingsFilesPresent
114113
*/
115-
public function validateHashSaltIsPresent() {
114+
public function validateSettingsFilesPresent() {
116115
if (!$this->getInspector()->isHashSaltPresent()) {
117-
// @todo Prompt to fix.
118116
throw new BltException("salt.txt is not present. Please run `blt setup:settings` to generate it.");
119117
}
118+
if (!$this->getInspector()->isDrupalLocalSettingsFilePresent()) {
119+
throw new BltException("Could not find settings.php for this site.");
120+
}
121+
// @todo Look for local.drushrc.php.
120122
}
121123

122124
/**

src/Robo/Inspector/Inspector.php

+1
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ public function isDrupalSettingsFilePresent() {
148148
public function isHashSaltPresent() {
149149
return file_exists($this->getConfigValue('repo.root') . '/salt.txt');
150150
}
151+
151152
/**
152153
* Determines if Drupal local.settings.php file exists.
153154
*

0 commit comments

Comments
 (0)