Skip to content

Commit 0267638

Browse files
authored
Merge pull request #7 from tyx/feature/new-namespace
Change vendor namespace
2 parents e4c81d9 + 7776d2b commit 0267638

File tree

12 files changed

+54
-41
lines changed

12 files changed

+54
-41
lines changed

.travis.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,20 @@
11
language: php
22

33
php:
4-
- 5.5
54
- 5.6
65
- 7.0
6+
- 7.1
7+
- 7.2
8+
9+
env:
10+
matrix:
11+
- COMPOSER_FLAGS=""
12+
- COMPOSER_FLAGS="--prefer-stable --prefer-lowest"
13+
- COMPOSER_FLAGS="--prefer-stable"
714

815
before_script:
9-
- composer install --prefer-dist --optimize-autoloader
16+
- composer clearcache
17+
- composer update $COMPOSER_FLAGS
1018
- bin/install-moco.sh
1119

1220
script:

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Moco Extension for Behat 3
22

3-
[![Build Status](https://travis-ci.org/rezzza/moco-behat-extension.svg?branch=master)](https://travis-ci.org/rezzza/moco-behat-extension)
3+
[![Build Status](https://travis-ci.org/ubirak/moco-behat-extension.svg?branch=master)](https://travis-ci.org/ubirak/moco-behat-extension)
44

55
[Moco](https://github.com/dreamhead/moco) is a stub server we used to use in test env.
66

@@ -11,14 +11,14 @@ Here is a small extension to make its usage more friendly.
1111
```yml
1212
default:
1313
extensions:
14-
Rezzza\MocoBehatExtension\MocoExtension:
14+
Ubirak\MocoBehatExtension\MocoExtension:
1515
json_file: features/fixtures.yml
1616
hostname: 127.0.0.1
1717
port: 9997
1818
suites:
1919
default:
2020
contexts:
21-
- Rezzza\MocoBehatExtension\MocoContext
21+
- Ubirak\MocoBehatExtension\MocoContext
2222
```
2323
2424
Then you just need to add `MocoWriter` as an argument of your context and tag your scenario with `@moco`

composer.json

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,22 @@
1010
"email": "[email protected]"
1111
}
1212
],
13+
"replace": {
14+
"rezzza/moco-behat-extension": "self.version"
15+
},
1316
"autoload": {
14-
"psr-4": { "Rezzza\\MocoBehatExtension\\": "src/" }
17+
"psr-4": { "Ubirak\\MocoBehatExtension\\": "src/" }
1518
},
1619
"require": {
1720
"php": ">=5.5.9",
1821
"behat/behat": "~3.0"
1922
},
2023
"require-dev": {
21-
"rezzza/rest-api-behat-extension": "^3.1",
24+
"ubirak/rest-api-behat-extension": "^7.0",
2225
"symfony/process": "^3.0",
23-
"atoum/atoum": "^2.8"
26+
"atoum/atoum": "^3.2",
27+
"php-http/curl-client": "^1.7",
28+
"guzzlehttp/psr7": "^1.4"
2429
},
2530
"bin": ["bin/install-moco.sh"]
2631
}

features/bootstrap/FeatureContext.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
use Symfony\Component\Process\PhpExecutableFinder;
88

99
/**
10-
* Test workflow totally copied from https://github.com/Behat/WebApiExtension/blob/master/features/bootstrap/FeatureContext.php
10+
* Test workflow totally copied from https://github.com/Behat/WebApiExtension/blob/master/features/bootstrap/FeatureContext.php.
1111
*/
1212
class FeatureContext implements Context
1313
{
@@ -44,8 +44,8 @@ public static function cleanTestFolders()
4444
*/
4545
public function prepareScenario()
4646
{
47-
$dir = self::workingDir() . DIRECTORY_SEPARATOR . md5(microtime() * rand(0, 10000));
48-
mkdir($dir . '/features/bootstrap', 0777, true);
47+
$dir = self::workingDir().DIRECTORY_SEPARATOR.md5((microtime(true) * rand(0, 10000)));
48+
mkdir($dir.'/features/bootstrap', 0777, true);
4949

5050
$phpFinder = new PhpExecutableFinder();
5151

@@ -64,7 +64,7 @@ public function prepareScenario()
6464
public function aFileNamedWith($filename, PyStringNode $fileContent)
6565
{
6666
$content = strtr((string) $fileContent, array("'''" => '"""'));
67-
$this->createFile($this->workingDir . '/' . $filename, $content);
67+
$this->createFile($this->workingDir.'/'.$filename, $content);
6868
}
6969

7070
/**
@@ -119,14 +119,14 @@ private function getExitCode()
119119

120120
private function getOutput()
121121
{
122-
$output = $this->process->getErrorOutput() . $this->process->getOutput();
122+
$output = $this->process->getErrorOutput().$this->process->getOutput();
123123

124124
// Normalize the line endings in the output
125125
if ("\n" !== PHP_EOL) {
126126
$output = str_replace(PHP_EOL, "\n", $output);
127127
}
128128

129-
return trim(preg_replace("/ +$/m", '', $output));
129+
return trim(preg_replace('/ +$/m', '', $output));
130130
}
131131

132132
private function createFile($filename, $content)
@@ -142,7 +142,7 @@ private function createFile($filename, $content)
142142

143143
public static function workingDir()
144144
{
145-
return sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'json-api-behat';
145+
return sys_get_temp_dir().DIRECTORY_SEPARATOR.'json-api-behat';
146146
}
147147

148148
private static function clearDirectory($path)
@@ -152,7 +152,7 @@ private static function clearDirectory($path)
152152
array_shift($files);
153153

154154
foreach ($files as $file) {
155-
$file = $path . DIRECTORY_SEPARATOR . $file;
155+
$file = $path.DIRECTORY_SEPARATOR.$file;
156156
if (is_dir($file)) {
157157
self::clearDirectory($file);
158158
} else {

features/check-moco.feature

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,19 @@ Feature: Check moco
88
"""
99
default:
1010
extensions:
11-
Rezzza\MocoBehatExtension\MocoExtension:
11+
Ubirak\MocoBehatExtension\MocoExtension:
1212
json_file: features/fixtures.yml
1313
hostname: 127.0.0.1
1414
port: 9997
15-
Rezzza\RestApiBehatExtension\Extension:
15+
Ubirak\RestApiBehatExtension\Extension:
1616
rest:
1717
base_url: http://127.0.0.1:9997
18-
adaptor_name: curl
18+
store_response: true
1919
suites:
2020
default:
2121
contexts:
22-
- Rezzza\RestApiBehatExtension\RestApiContext
23-
- Rezzza\MocoBehatExtension\MocoContext
22+
- Ubirak\RestApiBehatExtension\RestApiContext
23+
- Ubirak\MocoBehatExtension\MocoContext
2424
"""
2525
And a file named "features/call_moco.feature" with:
2626
"""

features/mock-http-call.feature

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,26 +8,26 @@ Feature: Mock HTTP call
88
"""
99
default:
1010
extensions:
11-
Rezzza\MocoBehatExtension\MocoExtension:
11+
Ubirak\MocoBehatExtension\MocoExtension:
1212
json_file: features/fixtures.yml
1313
hostname: 127.0.0.1
1414
port: 9999
15-
Rezzza\RestApiBehatExtension\Extension:
15+
Ubirak\RestApiBehatExtension\Extension:
1616
rest:
1717
base_url: http://127.0.0.1:9999
18-
adaptor_name: curl
18+
store_response: true
1919
suites:
2020
default:
2121
contexts:
2222
- FeatureContext
23-
- Rezzza\RestApiBehatExtension\RestApiContext
24-
- Rezzza\MocoBehatExtension\MocoContext
23+
- Ubirak\RestApiBehatExtension\RestApiContext
24+
- Ubirak\MocoBehatExtension\MocoContext
2525
"""
2626
And a file named "features/bootstrap/FeatureContext.php" with:
2727
"""
2828
<?php
2929
use Behat\Behat\Context\Context;
30-
use Rezzza\MocoBehatExtension\MocoWriter;
30+
use Ubirak\MocoBehatExtension\MocoWriter;
3131
3232
class FeatureContext implements Context
3333
{

src/MocoContext.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace Rezzza\MocoBehatExtension;
3+
namespace Ubirak\MocoBehatExtension;
44

55
use Behat\Behat\Context\Context;
66
use Behat\Behat\Hook\Scope\AfterScenarioScope;

src/MocoExtension.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace Rezzza\MocoBehatExtension;
3+
namespace Ubirak\MocoBehatExtension;
44

55
use Behat\Testwork\ServiceContainer\Extension;
66
use Behat\Testwork\ServiceContainer\ExtensionManager;
@@ -13,9 +13,9 @@ class MocoExtension implements Extension
1313
{
1414
public function load(ContainerBuilder $container, array $config)
1515
{
16-
$container->setParameter('rezzza.moco.json_file', $config['json_file']);
17-
$container->setParameter('rezzza.moco.port', $config['port']);
18-
$container->setParameter('rezzza.moco.hostname', $config['hostname']);
16+
$container->setParameter('ubirak.moco.json_file', $config['json_file']);
17+
$container->setParameter('ubirak.moco.port', $config['port']);
18+
$container->setParameter('ubirak.moco.hostname', $config['hostname']);
1919
$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/Resources/config'));
2020
$loader->load('services.xml');
2121
}

src/MocoWriter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace Rezzza\MocoBehatExtension;
3+
namespace Ubirak\MocoBehatExtension;
44

55
class MocoWriter
66
{

src/MocoWriterResolver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace Rezzza\MocoBehatExtension;
3+
namespace Ubirak\MocoBehatExtension;
44

55
use Behat\Behat\Context\Argument\ArgumentResolver;
66

0 commit comments

Comments
 (0)