-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This makes sure that WordPress is only installed once at the beginning and also makes sure that the admin-email page is not displayed every now and then. That requires some magic but as that only happes once at the beginning that is OK.
- Loading branch information
1 parent
ed0ac96
commit 68f12a1
Showing
1 changed file
with
33 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,11 +22,21 @@ class FeatureContext implements Context | |
* Every scenario gets its own context instance. | ||
* You can also pass arbitrary arguments to the | ||
* context constructor through behat.yml. | ||
* | ||
* @BeforeSuite | ||
*/ | ||
public function __construct() | ||
public static function beforeSuite() | ||
{ | ||
exec('wp --allow-root core install --url=localhost --title=Example --admin_user=localadmin --admin_password=P@ssw0rd [email protected]'); | ||
exec('wp --allow-root plugin activate authldap'); | ||
exec('wp --allow-root plugin is-active authldap', $response, $code); | ||
if ($code !== 0) { | ||
exec('wp --allow-root plugin activate authldap'); | ||
} | ||
exec('wp --allow-root theme list | grep -E "\Wactive" | awk \'{ print $1; }\'', $result); | ||
exec ('wp --allow-root theme path ' . $result[0] . ' --dir', $output, $code); | ||
file_put_contents($output[0] . '/functions.php', <<<'EOF' | ||
<?php add_filter( 'admin_email_check_interval', '__return_false' ); | ||
EOF); | ||
} | ||
|
||
|
||
|
@@ -153,6 +163,18 @@ public function anLdapGroupExists($arg1) | |
*/ | ||
public function aWordpressUserWithNameAndEmailExists($arg1, $arg2, $arg3) | ||
{ | ||
exec(sprintf( | ||
'wp --allow-root user get %1$s', | ||
$arg1 | ||
), $result, $code); | ||
if ($code === 0) { | ||
|
||
exec(sprintf( | ||
'wp --allow-root user delete %1$s --yes', | ||
$arg1 | ||
)); | ||
} | ||
|
||
exec(sprintf( | ||
'wp --allow-root user create %1$s %3$s --display_name=%2$s --porcelain', | ||
$arg1, | ||
|
@@ -167,9 +189,15 @@ public function aWordpressUserWithNameAndEmailExists($arg1, $arg2, $arg3) | |
public function aWordpressRoleExists($arg1) | ||
{ | ||
exec(sprintf( | ||
'wp --allow-root role create %1$s %1$s', | ||
$arg1, | ||
)); | ||
'wp --allow-root role exists %1$s', | ||
$arg1 | ||
), $result, $code); | ||
if ($code !== 0) { | ||
exec(sprintf( | ||
'wp --allow-root role create %1$s %1$s', | ||
$arg1, | ||
)); | ||
} | ||
} | ||
|
||
/** | ||
|