mirror of
https://github.com/silverstripe/silverstripe-behat-extension
synced 2024-10-22 17:05:32 +02:00
Merge branch '4.0' into 4
This commit is contained in:
commit
fc9315123e
@ -1,10 +1,4 @@
|
|||||||
version: ~> 1.0
|
version: ~> 1.0
|
||||||
|
|
||||||
import:
|
import:
|
||||||
- silverstripe/silverstripe-travis-shared:config/provision/standard-jobs-fixed.yml
|
- silverstripe/silverstripe-travis-shared:config/provision/standard-jobs-range.yml
|
||||||
|
|
||||||
env:
|
|
||||||
global:
|
|
||||||
- COMPOSER_ROOT_VERSION="1.x-dev"
|
|
||||||
- REQUIRE_RECIPE="4.x-dev"
|
|
||||||
- PHPUNIT_TEST=1
|
|
||||||
|
61
build.php
61
build.php
@ -1,61 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This file is part of the Behat/SilverStripeExtension
|
|
||||||
*
|
|
||||||
* (c) Michał Ochman <ochman.d.michal@gmail.com>
|
|
||||||
*
|
|
||||||
* This source file is subject to the MIT license that is bundled
|
|
||||||
* with this source code in the file LICENSE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
$filename = 'silverstripe_extension.phar';
|
|
||||||
|
|
||||||
if (file_exists($filename)) {
|
|
||||||
unlink($filename);
|
|
||||||
}
|
|
||||||
|
|
||||||
$phar = new \Phar($filename, 0, 'extension.phar');
|
|
||||||
$phar->setSignatureAlgorithm(\Phar::SHA1);
|
|
||||||
$phar->startBuffering();
|
|
||||||
|
|
||||||
foreach (findFiles('src') as $path) {
|
|
||||||
$phar->addFromString($path, file_get_contents(__DIR__ . '/' . $path));
|
|
||||||
}
|
|
||||||
|
|
||||||
$phar->addFromString('init.php', file_get_contents(__DIR__ . '/init.php'));
|
|
||||||
|
|
||||||
$phar->setStub(<<<STUB
|
|
||||||
<?php
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This file is part of the SilverStripe-Behaviour-Testing-Framework
|
|
||||||
*
|
|
||||||
* (c) Michał Ochman <ochman.d.michal@gmail.com>
|
|
||||||
*
|
|
||||||
* This source file is subject to the MIT license that is bundled
|
|
||||||
* with this source code in the file LICENSE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
Phar::mapPhar('extension.phar');
|
|
||||||
|
|
||||||
return require 'phar://extension.phar/init.php';
|
|
||||||
|
|
||||||
__HALT_COMPILER();
|
|
||||||
STUB
|
|
||||||
);
|
|
||||||
$phar->stopBuffering();
|
|
||||||
|
|
||||||
function findFiles($dir)
|
|
||||||
{
|
|
||||||
$iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir), RecursiveIteratorIterator::CHILD_FIRST);
|
|
||||||
|
|
||||||
$files = array();
|
|
||||||
foreach ($iterator as $path) {
|
|
||||||
if ($path->isFile()) {
|
|
||||||
$files[] = $path->getPath() . DIRECTORY_SEPARATOR . $path->getFilename();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $files;
|
|
||||||
}
|
|
@ -23,6 +23,7 @@
|
|||||||
"require": {
|
"require": {
|
||||||
"php": ">=5.6",
|
"php": ">=5.6",
|
||||||
"sminnee/phpunit": "^5.7",
|
"sminnee/phpunit": "^5.7",
|
||||||
|
"squizlabs/php_codesniffer": "^3",
|
||||||
"behat/behat": "^3.2",
|
"behat/behat": "^3.2",
|
||||||
"behat/mink": "^1.7",
|
"behat/mink": "^1.7",
|
||||||
"behat/mink-extension": "^2.1",
|
"behat/mink-extension": "^2.1",
|
||||||
@ -34,11 +35,7 @@
|
|||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
"SilverStripe\\BehatExtension\\": "src/"
|
"SilverStripe\\BehatExtension\\": "src/",
|
||||||
}
|
|
||||||
},
|
|
||||||
"autoload-dev": {
|
|
||||||
"psr-4": {
|
|
||||||
"SilverStripe\\BehatExtension\\Tests\\": "tests/php/"
|
"SilverStripe\\BehatExtension\\Tests\\": "tests/php/"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
19
init.php
19
init.php
@ -1,19 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This file is part of the Behat/SilverStripeExtension
|
|
||||||
*
|
|
||||||
* (c) Michał Ochman <ochman.d.michal@gmail.com>
|
|
||||||
*
|
|
||||||
* This source file is subject to the MIT license that is bundled
|
|
||||||
* with this source code in the file LICENSE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
spl_autoload_register(function ($class) {
|
|
||||||
if (false !== strpos($class, 'SilverStripe\\BehatExtension')) {
|
|
||||||
require_once(__DIR__ . '/src/' . str_replace('\\', '/', $class) . '.php');
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}, true, false);
|
|
||||||
|
|
||||||
return new SilverStripe\BehatExtension\Extension;
|
|
17
phpcs.xml.dist
Normal file
17
phpcs.xml.dist
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ruleset name="SilverStripe">
|
||||||
|
<description>CodeSniffer ruleset for SilverStripe coding conventions.</description>
|
||||||
|
|
||||||
|
<file>src</file>
|
||||||
|
<file>tests</file>
|
||||||
|
|
||||||
|
<!-- base rules are PSR-2 -->
|
||||||
|
<rule ref="PSR2" >
|
||||||
|
<!-- Current exclusions -->
|
||||||
|
<exclude name="PSR1.Methods.CamelCapsMethodName" />
|
||||||
|
<exclude name="PSR2.Classes.PropertyDeclaration.Underscore" />
|
||||||
|
<exclude name="Squiz.Classes.ValidClassName.NotCamelCaps" />
|
||||||
|
<exclude name="Generic.Files.LineLength.TooLong" />
|
||||||
|
<exclude name="PSR1.Files.SideEffects.FoundWithSymbols" />
|
||||||
|
</rule>
|
||||||
|
</ruleset>
|
@ -87,7 +87,7 @@ abstract class SilverStripeContext extends MinkContext implements SilverStripeAw
|
|||||||
*/
|
*/
|
||||||
public function __construct(array $parameters = null)
|
public function __construct(array $parameters = null)
|
||||||
{
|
{
|
||||||
if (!preg_match('/\\\FeatureContext$/', get_class($this))) {
|
if (!preg_match('#[\\\]FeatureContext$#', get_class($this))) {
|
||||||
throw new InvalidArgumentException(
|
throw new InvalidArgumentException(
|
||||||
'Subclasses of SilverStripeContext must be named FeatureContext. Found "' . get_class($this) . '""'
|
'Subclasses of SilverStripeContext must be named FeatureContext. Found "' . get_class($this) . '""'
|
||||||
);
|
);
|
||||||
|
@ -11,18 +11,11 @@ use Behat\Mink\Element\Element;
|
|||||||
use SilverStripe\BehatExtension\Tests\SilverStripeContextTest\FeatureContext;
|
use SilverStripe\BehatExtension\Tests\SilverStripeContextTest\FeatureContext;
|
||||||
use SilverStripe\Dev\SapphireTest;
|
use SilverStripe\Dev\SapphireTest;
|
||||||
|
|
||||||
class SilverStripeContextTest extends \PHPUnit_Framework_TestCase
|
class SilverStripeContextTest extends SapphireTest
|
||||||
{
|
{
|
||||||
|
|
||||||
protected $backupGlobals = false;
|
protected $backupGlobals = false;
|
||||||
|
|
||||||
public static function setUpBeforeClass()
|
|
||||||
{
|
|
||||||
// Bootstrap test environment
|
|
||||||
parent::setUpBeforeClass();
|
|
||||||
SapphireTest::start();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @expectedException \LogicException
|
* @expectedException \LogicException
|
||||||
* @expectedExceptionMessage Cannot find 'region_map' in the behat.yml
|
* @expectedExceptionMessage Cannot find 'region_map' in the behat.yml
|
||||||
|
Loading…
Reference in New Issue
Block a user