diff --git a/docs/circleci-tutorial.md b/docs/circleci-tutorial.md index 63ba9135..e3f8de89 100644 --- a/docs/circleci-tutorial.md +++ b/docs/circleci-tutorial.md @@ -1,16 +1,16 @@ #Setting up CircleCI and Behat -If you'd like to run SilverStripe Behat tests on CircleCI, this can be achieved (along with screenshot artifacts on +If you'd like to run SilverStripe Behat tests on CircleCI, this can be achieved (along with screenshot artifacts on error) reasonably easily. - -The below extract is a full `circle.yml` configuration file that gets the environment setup and running for Behat tests. + +The below extract is a full `circle.yml` configuration file that gets the environment setup and running for Behat tests. Please review it thoroughly as there are a few things you'll need to change for your individual project. Notably: * If you already have a behat.yml, you should ensure your local requirements are reflected as the following script will - overwrite the behat.yml file in order to ensure screenshot failures are stored in a CircleCI-appropriate directory, + overwrite the behat.yml file in order to ensure screenshot failures are stored in a CircleCI-appropriate directory, even if you don't store screenshots locally. - * There is one variable required below (`REPO-NAME`) that you need to fill out yourself depending on the name of your + * There is one variable required below (`REPO-NAME`) that you need to fill out yourself depending on the name of your repository (CircleCI will check out your code into a sub-directory of the user's homedir based on the repository name). - * This assumes your Behat fixtures are located under the mysite/ directory. If not, check the `test.override` section + * This assumes your Behat fixtures are located under the mysite/ directory. If not, check the `test.override` section below. ``` @@ -23,17 +23,17 @@ dependencies: - ~/.composer/cache pre: - # Enable xdebug - this is for code coverage and may not be necessary for you. Remove if you don't need it, it can + # Enable xdebug - this is for code coverage and may not be necessary for you. Remove if you don't need it, it can # drastically slow down tests - sed -i 's/^;//' ~/.phpenv/versions/$(phpenv global)/etc/conf.d/xdebug.ini - - # We found that some machines have outdated composer versions, so we self-update before running install just in case + + # We found that some machines have outdated composer versions, so we self-update before running install just in case - sudo composer self-update - composer install --prefer-source --no-interaction - + # Behat and SilverStripe often require a reasonably large amount of memory, tune to your specific needs - echo "memory_limit = 512M" > ~/.phpenv/versions/$(phpenv global)/etc/conf.d/memory.ini - + # Setup the _ss_environment.php file per https://docs.silverstripe.org/en/3.4/getting_started/environment_management - | cat << 'EOF' > _ss_environment.php @@ -43,7 +43,7 @@ dependencies: define('SS_DATABASE_USERNAME', 'ubuntu'); define('SS_DATABASE_PASSWORD', ''); define('SS_ENVIRONMENT_TYPE', 'dev'); - + global $_FILE_TO_URL_MAPPING; $_FILE_TO_URL_MAPPING['/home/ubuntu/REPO-NAME'] = 'http://localhost:8080/'; EOF @@ -69,7 +69,7 @@ dependencies: - a2enmod rewrite - sudo service apache2 restart - # Get Selenium setup - we currently do this everytime but ideally we could store in the cache_directories and only + # Get Selenium setup - we currently do this everytime but ideally we could store in the cache_directories and only # grab if it doesn't exist to save time - an exercise left to the reader! - wget http://selenium-release.storage.googleapis.com/2.52/selenium-server-standalone-2.52.0.jar - 'java -jar selenium-server-standalone-2.52.0.jar > /dev/null 2>&1': @@ -85,7 +85,7 @@ dependencies: # Create assets directory and add group perms - if [ ! -d assets ]; then mkdir assets && chmod 777 assets; fi - + # Setup behat.yml - you will need to merge your current behat.yml into this configuration - | cat > behat.yml <get(EventDispatcherInterface::class . '.mailer'); $transport = new NullTransport($dispatcher); $this->mailer = new TestMailer($transport, $dispatcher); diff --git a/src/Context/FixtureContext.php b/src/Context/FixtureContext.php index 0b6add0d..40ffaa0d 100644 --- a/src/Context/FixtureContext.php +++ b/src/Context/FixtureContext.php @@ -691,7 +691,7 @@ public function stepGoToNamedRecord($type, $id) } /** - * Adds an extension and runs dev/build?flush + * Adds an extension and visits /dev/build?flush * * @param $extension * @param $class @@ -704,7 +704,7 @@ public function iAddAnExtensionToTheClass($extension, $class) } /** - * Adds an extension, but doesn't run dev/build afterwards. Will still run ?flush + * Adds an extension, but doesn't visit /dev/build afterwards. Will still run ?flush * * @param $extension * @param $class diff --git a/src/Utility/TestMailer.php b/src/Utility/TestMailer.php index 8b8d7a2e..6d684508 100644 --- a/src/Utility/TestMailer.php +++ b/src/Utility/TestMailer.php @@ -4,7 +4,7 @@ use InvalidArgumentException; use SilverStripe\Control\Email\Email; -use Symfony\Component\EventDispatcher\EventDispatcherInterface; +use Symfony\Contracts\EventDispatcher\EventDispatcherInterface; use SilverStripe\Dev\TestMailer as BaseTestMailer; use SilverStripe\TestSession\TestSessionEnvironment; use Symfony\Component\Mailer\Envelope;