Skip to content
This repository was archived by the owner on Apr 20, 2021. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion behat.yml-dist
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ default:
files_path: 'fixtures/files'
goutte: ~
selenium2: ~
Sanpi\Behatch\Extension: ~
Behatch\Extension: ~
4 changes: 2 additions & 2 deletions bin/main
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
*/

spl_autoload_register(function($class) {
if (false !== strpos($class, 'Sanpi\\Behatch')) {
if (false !== strpos($class, 'Behatch')) {
require_once(__DIR__.'/../src/'.str_replace('\\', '/', $class).'.php');
return true;
}
}, true, false);

return new Sanpi\Behatch\Extension;
return new Behatch\Extension;
6 changes: 1 addition & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,11 @@

"autoload": {
"psr-4": {
"Sanpi\\Behatch\\": "src/"
"Behatch\\": "src/"
}
},

"config": {
"bin-dir": "bin/"
},

"replace": {
"sanpi/Behatch-skeleton": "self.version"
}
}
2 changes: 1 addition & 1 deletion doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ Project dependancy
default:
# ...
extensions:
Sanpi\Behatch\Extension: ~
Behatch\Extension: ~

Project boostraping
*******************
Expand Down
2 changes: 1 addition & 1 deletion src/Context/BaseContext.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Sanpi\Behatch\Context;
namespace Behatch\Context;

use Behat\Behat\Context\TranslatableContext;
use Behat\MinkExtension\Context\RawMinkContext;
Expand Down
2 changes: 1 addition & 1 deletion src/Context/BrowserContext.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Sanpi\Behatch\Context;
namespace Behatch\Context;

use Behat\Behat\Context\Step;
use Behat\Gherkin\Node\TableNode;
Expand Down
4 changes: 2 additions & 2 deletions src/Context/ContextClass/ClassResolver.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Sanpi\Behatch\Context\ContextClass;
namespace Behatch\Context\ContextClass;

use Behat\Behat\Context\ContextClass\ClassResolver as BaseClassResolver;

Expand All @@ -16,6 +16,6 @@ public function resolveClass($contextClass)
list(, $className) = explode(':', $contextClass);

$className = ucfirst($className);
return "\\Sanpi\\Behatch\\Context\\{$className}Context";
return "\\Behatch\\Context\\{$className}Context";
}
}
2 changes: 1 addition & 1 deletion src/Context/DebugContext.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Sanpi\Behatch\Context;
namespace Behatch\Context;

use Behat\Behat\Event\StepEvent;

Expand Down
12 changes: 6 additions & 6 deletions src/Context/JsonContext.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<?php

namespace Sanpi\Behatch\Context;
namespace Behatch\Context;

use Behat\Gherkin\Node\PyStringNode;

use Sanpi\Behatch\Json\Json;
use Sanpi\Behatch\Json\JsonSchema;
use Sanpi\Behatch\Json\JsonInspector;
use Sanpi\Behatch\HttpCall\HttpCallResultAware;
use Sanpi\Behatch\HttpCall\HttpCallResultPool;
use Behatch\Json\Json;
use Behatch\Json\JsonSchema;
use Behatch\Json\JsonInspector;
use Behatch\HttpCall\HttpCallResultAware;
use Behatch\HttpCall\HttpCallResultPool;

class JsonContext extends BaseContext
{
Expand Down
2 changes: 1 addition & 1 deletion src/Context/RestContext.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Sanpi\Behatch\Context;
namespace Behatch\Context;

use Behat\Behat\Context\Step;
use Behat\Gherkin\Node\TableNode;
Expand Down
2 changes: 1 addition & 1 deletion src/Context/SystemContext.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Sanpi\Behatch\Context;
namespace Behatch\Context;

use Behat\Behat\Context\Step;
use Behat\Gherkin\Node\PyStringNode;
Expand Down
2 changes: 1 addition & 1 deletion src/Context/TableContext.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Sanpi\Behatch\Context;
namespace Behatch\Context;

use Behat\Gherkin\Node\TableNode;

Expand Down
2 changes: 1 addition & 1 deletion src/Context/XmlContext.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Sanpi\Behatch\Context;
namespace Behatch\Context;

use Behat\Gherkin\Node\PyStringNode;

Expand Down
4 changes: 2 additions & 2 deletions src/Extension.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Sanpi\Behatch;
namespace Behatch;

use Symfony\Component\Config\FileLocator;
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
Expand Down Expand Up @@ -42,7 +42,7 @@ public function configure(ArrayNodeDefinition $builder)

private function loadClassResolver(ContainerBuilder $container)
{
$definition = new Definition('Sanpi\Behatch\Context\ContextClass\ClassResolver');
$definition = new Definition('Behatch\Context\ContextClass\ClassResolver');
$definition->addTag(ContextExtension::CLASS_RESOLVER_TAG);
$container->setDefinition('behatch.class_resolver', $definition);
}
Expand Down
2 changes: 1 addition & 1 deletion src/HttpCall/ContextSupportedVoter.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Sanpi\Behatch\HttpCall;
namespace Behatch\HttpCall;

interface ContextSupportedVoter
{
Expand Down
2 changes: 1 addition & 1 deletion src/HttpCall/ContextSupportedVoters.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Sanpi\Behatch\HttpCall;
namespace Behatch\HttpCall;

class ContextSupportedVoters implements ContextSupportedVoter
{
Expand Down
2 changes: 1 addition & 1 deletion src/HttpCall/FilterableHttpCallResult.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Sanpi\Behatch\HttpCall;
namespace Behatch\HttpCall;

interface FilterableHttpCallResult
{
Expand Down
2 changes: 1 addition & 1 deletion src/HttpCall/HttpCallListener.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Sanpi\Behatch\HttpCall;
namespace Behatch\HttpCall;

use Behat\Behat\EventDispatcher\Event\StepTested;
use Behat\Behat\EventDispatcher\Event\AfterStepTested;
Expand Down
2 changes: 1 addition & 1 deletion src/HttpCall/HttpCallResult.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Sanpi\Behatch\HttpCall;
namespace Behatch\HttpCall;

class HttpCallResult
{
Expand Down
2 changes: 1 addition & 1 deletion src/HttpCall/HttpCallResultPool.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Sanpi\Behatch\HttpCall;
namespace Behatch\HttpCall;

class HttpCallResultPool
{
Expand Down
6 changes: 3 additions & 3 deletions src/HttpCall/HttpCallResultPoolResolver.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?php

namespace Sanpi\Behatch\HttpCall;
namespace Behatch\HttpCall;

use Behat\Behat\Context\Environment\Handler\ContextEnvironmentHandler;
use Behat\Behat\Context\Argument\ArgumentResolver;

use Sanpi\Behatch\HttpCall\HttpCallResultPool;
use Behatch\HttpCall\HttpCallResultPool;

class HttpCallResultPoolResolver implements ArgumentResolver
{
Expand All @@ -22,7 +22,7 @@ public function resolveArguments(\ReflectionClass $classReflection, array $argum
if ($constructor !== null) {
$parameters = $constructor->getParameters();
foreach ($parameters as $parameter) {
if (null !== $parameter->getClass() && $parameter->getClass()->name === 'Sanpi\\Behatch\\HttpCall\\HttpCallResultPool') {
if (null !== $parameter->getClass() && $parameter->getClass()->name === 'Behatch\\HttpCall\\HttpCallResultPool') {
$arguments[$parameter->name] = $this->httpCallResultPool;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/HttpCall/RestContextVoter.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Sanpi\Behatch\HttpCall;
namespace Behatch\HttpCall;

class RestContextVoter implements ContextSupportedVoter, FilterableHttpCallResult
{
Expand Down
2 changes: 1 addition & 1 deletion src/Json/Json.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Sanpi\Behatch\Json;
namespace Behatch\Json;

use Symfony\Component\PropertyAccess\PropertyAccessor;

Expand Down
2 changes: 1 addition & 1 deletion src/Json/JsonInspector.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Sanpi\Behatch\Json;
namespace Behatch\Json;

use JsonSchema\RefResolver;
use JsonSchema\Validator;
Expand Down
2 changes: 1 addition & 1 deletion src/Json/JsonSchema.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Sanpi\Behatch\Json;
namespace Behatch\Json;

use JsonSchema\RefResolver;
use JsonSchema\Validator;
Expand Down
10 changes: 5 additions & 5 deletions src/Resources/services/http_call.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
services:
behatch.http_call.listener:
class: Sanpi\Behatch\HttpCall\HttpCallListener
class: Behatch\HttpCall\HttpCallListener
arguments: [@behatch.context_supported.voter, @behatch.http_call.result_pool, @mink]
tags:
- { name: event_dispatcher.subscriber, priority: 0 }

behatch.http_call.result_pool:
class: Sanpi\Behatch\HttpCall\HttpCallResultPool
class: Behatch\HttpCall\HttpCallResultPool

behatch.context_supported.voter:
class: Sanpi\Behatch\HttpCall\ContextSupportedVoters
class: Behatch\HttpCall\ContextSupportedVoters

behatch.rest_context_supported.voter:
class: Sanpi\Behatch\HttpCall\RestContextVoter
class: Behatch\HttpCall\RestContextVoter
tags:
- { name: behatch.context_voter }

behatch.http_call.argument_resolver:
class: Sanpi\Behatch\HttpCall\HttpCallResultPoolResolver
class: Behatch\HttpCall\HttpCallResultPoolResolver
arguments: [@behatch.http_call.result_pool]
tags:
- { name: context.argument_resolver }
6 changes: 3 additions & 3 deletions tests/units/Json/Json.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php

namespace Sanpi\Behatch\Tests\Units\Json;
namespace Behatch\Tests\Units\Json;

use \atoum;
use Sanpi\Behatch\Json\Json as TestedClass;
use atoum;
use Behatch\Json\Json as TestedClass;
use Symfony\Component\PropertyAccess\PropertyAccess;

class Json extends atoum
Expand Down
16 changes: 8 additions & 8 deletions tests/units/Json/JsonInspector.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?php

namespace Sanpi\Behatch\Tests\Units\Json;
namespace Behatch\Tests\Units\Json;

use \atoum;
use JsonSchema\RefResolver;
use JsonSchema\Validator;
use JsonSchema\Uri\UriRetriever;
use Sanpi\Behatch\Json\JsonInspector as TestedClass;
use Behatch\Json\JsonInspector as TestedClass;
use Symfony\Component\PropertyAccess\PropertyAccess;

class JsonInspector extends atoum
Expand All @@ -15,7 +15,7 @@ public function test_should_read_json()
{
$this
->given(
$json = new \mock\Sanpi\Behatch\Json\Json('{}'),
$json = new \mock\Behatch\Json\Json('{}'),
$json->getMockController()->read = 'foobar'
)
->and(
Expand All @@ -38,7 +38,7 @@ public function test_should_fail_if_json_reading_fail()
{
$this
->given(
$json = new \mock\Sanpi\Behatch\Json\Json('{}'),
$json = new \mock\Behatch\Json\Json('{}'),
$json->getMockController()->read->throw = new \Exception()
)
->and(
Expand All @@ -55,7 +55,7 @@ public function test_should_convert_expression_if_javascript_mode()
{
$this
->given(
$json = new \mock\Sanpi\Behatch\Json\Json('{}'),
$json = new \mock\Behatch\Json\Json('{}'),
$json->getMockController()->read = 'foobar'
)
->and(
Expand All @@ -78,7 +78,7 @@ public function test_should_no_convert_expression_if_no_javascript_mode()
{
$this
->given(
$json = new \mock\Sanpi\Behatch\Json\Json('{}'),
$json = new \mock\Behatch\Json\Json('{}'),
$json->getMockController()->read = 'foobar'
)
->and(
Expand All @@ -101,8 +101,8 @@ public function test_should_valid_json_through_its_schema()
{
$this
->given(
$json = new \mock\Sanpi\Behatch\Json\Json('{}'),
$schema = new \mock\Sanpi\Behatch\Json\JsonSchema('{}'),
$json = new \mock\Behatch\Json\Json('{}'),
$schema = new \mock\Behatch\Json\JsonSchema('{}'),
$schema->getMockController()->resolve = $schema,
$schema->getMockController()->validate = 'foobar',
$inspector = new TestedClass('foo')
Expand Down
10 changes: 5 additions & 5 deletions tests/units/Json/JsonSchema.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php

namespace Sanpi\Behatch\Tests\Units\Json;
namespace Behatch\Tests\Units\Json;

use \atoum;
use Sanpi\Behatch\Json\JsonSchema as TestedClass;
use atoum;
use Behatch\Json\JsonSchema as TestedClass;

class JsonSchema extends atoum
{
Expand Down Expand Up @@ -51,7 +51,7 @@ public function test_should_validate_correct_json()
$this
->given(
$schema = new TestedClass('{}'),
$json = new \Sanpi\Behatch\Json\Json('{}'),
$json = new \Behatch\Json\Json('{}'),
$validator = new \mock\JsonSchema\Validator,
$validator->getMockController()->check = true
)
Expand All @@ -73,7 +73,7 @@ public function test_should_throw_exception_for_incorrect_json()
$this
->given(
$schema = new TestedClass('{}'),
$json = new \Sanpi\Behatch\Json\Json('{}'),
$json = new \Behatch\Json\Json('{}'),
$validator = new \mock\JsonSchema\Validator,
$validator->getMockController()->check = false,
$validator->getMockController()->getErrors = array(
Expand Down