Skip to content

Commit 169aa94

Browse files
Merge pull request #89 from mrrobot47/update/debugging
Update for EE::launch changes in core
2 parents b5821e8 + f07c816 commit 169aa94

File tree

4 files changed

+48
-18
lines changed

4 files changed

+48
-18
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ before_script:
2020

2121
script:
2222
- cd "$TRAVIS_BUILD_DIR/../easyengine"
23-
- ./vendor/bin/behat
23+
- sudo ./vendor/bin/behat
2424

2525
after_script:
2626
- cat /opt/easyengine/ee.log

features/bootstrap/FeatureContext.php

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,48 @@
11
<?php
2+
/**
3+
* Behat tests.
4+
*
5+
* @package ee-cli
6+
*/
27

3-
include_once(__DIR__ . '/../../php/class-ee.php');
4-
include_once(__DIR__ . '/../../php/utils.php');
8+
/* Start: Loading required files to enable EE::launch() in tests. */
9+
define( 'EE_ROOT', __DIR__ . '/../..' );
510

11+
include_once( EE_ROOT . '/php/class-ee.php' );
12+
include_once( EE_ROOT . '/php/EE/Runner.php' );
13+
include_once( EE_ROOT . '/php/utils.php' );
14+
15+
define( 'EE', true );
16+
define( 'EE_VERSION', trim( file_get_contents( EE_ROOT . '/VERSION' ) ) );
617
define( 'EE_CONF_ROOT', '/opt/easyengine' );
718

19+
require_once EE_ROOT . '/php/bootstrap.php';
20+
21+
if ( ! class_exists( 'EE\Runner' ) ) {
22+
require_once EE_ROOT . '/php/EE/Runner.php';
23+
}
24+
25+
if ( ! class_exists( 'EE\Configurator' ) ) {
26+
require_once EE_ROOT . '/php/EE/Configurator.php';
27+
}
28+
29+
$logger_dir = EE_ROOT . '/php/EE/Loggers';
30+
$iterator = new \DirectoryIterator( $logger_dir );
31+
32+
// Make sure the base class is declared first.
33+
include_once "$logger_dir/Base.php";
34+
35+
foreach ( $iterator as $filename ) {
36+
if ( '.php' !== pathinfo( $filename, PATHINFO_EXTENSION ) ) {
37+
continue;
38+
}
39+
40+
include_once "$logger_dir/$filename";
41+
}
42+
$runner = \EE::get_runner();
43+
$runner->init_logger();
44+
/* End. Loading required files to enable EE::launch() in tests. */
45+
846
use Behat\Behat\Context\Context;
947
use Behat\Behat\Hook\Scope\AfterFeatureScope;
1048
use Behat\Behat\Hook\Scope\AfterScenarioScope;

features/redirect.feature

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
Feature: Site Redirection
22

33
Scenario: no_www-no_ssl redirection works properly
4-
When I run 'sudo bin/ee site create example.test'
4+
When I run 'bin/ee site create example.test'
55
Then Request on 'localhost' with header 'Host: www.example.test' should contain following headers:
66
| header |
77
| HTTP/1.1 301 Moved Permanently |
88
| Location: http://example.test/ |
99

1010
Scenario: www-no_ssl redirection works properly
11-
When I run 'sudo bin/ee site create www.example1.test'
11+
When I run 'bin/ee site create www.example1.test'
1212
Then Request on 'localhost' with header 'Host: example1.test' should contain following headers:
1313
| header |
1414
| HTTP/1.1 301 Moved Permanently |

features/site.feature

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,8 @@
11
Feature: Site Command
22

3-
Scenario: ee throws error when run without root
4-
Given 'bin/ee' is installed
5-
When I run 'bin/ee'
6-
Then STDERR should return exactly
7-
"""
8-
Error: Please run `ee` with root privileges.
9-
"""
10-
113
Scenario: ee executable is command working correctly
124
Given 'bin/ee' is installed
13-
When I run 'sudo bin/ee'
5+
When I run 'bin/ee'
146
Then STDOUT should return something like
157
"""
168
NAME
@@ -19,28 +11,28 @@ Feature: Site Command
1911
"""
2012

2113
Scenario: Check site command is present
22-
When I run 'sudo bin/ee site'
14+
When I run 'bin/ee site'
2315
Then STDOUT should return something like
2416
"""
2517
usage: ee site
2618
"""
2719

2820
Scenario: Create html site successfully
29-
When I run 'sudo bin/ee site create site.test --type=html'
21+
When I run 'bin/ee site create site.test --type=html'
3022
Then The site 'site.test' should have webroot
3123
And Request on 'site.test' should contain following headers:
3224
| header |
3325
| HTTP/1.1 200 OK |
3426

3527
Scenario: List the sites
36-
When I run 'sudo bin/ee site list --format=text'
28+
When I run 'bin/ee site list --format=text'
3729
Then STDOUT should return exactly
3830
"""
3931
site.test
4032
"""
4133

4234
Scenario: Delete the sites
43-
When I run 'sudo bin/ee site delete site.test --yes'
35+
When I run 'bin/ee site delete site.test --yes'
4436
Then STDOUT should return something like
4537
"""
4638
Site site.test deleted.

0 commit comments

Comments
 (0)