|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* The MIT License (MIT) |
|
5
|
|
|
* |
|
6
|
|
|
* Copyright (c) 2014-2016 Spomky-Labs |
|
7
|
|
|
* |
|
8
|
|
|
* This software may be modified and distributed under the terms |
|
9
|
|
|
* of the MIT license. See the LICENSE file for details. |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
namespace Jose\Test\Context; |
|
13
|
|
|
|
|
14
|
|
|
use Behat\Behat\Context\Context; |
|
15
|
|
|
use Behat\Symfony2Extension\Context\KernelDictionary; |
|
16
|
|
|
use Jose\Component\Encryption\Compression\CompressionMethodManager; |
|
17
|
|
|
use Jose\Component\Encryption\Compression\CompressionMethodManagerFactory; |
|
18
|
|
|
|
|
19
|
|
|
final class CompressionContext implements Context |
|
20
|
|
|
{ |
|
21
|
|
|
use KernelDictionary; |
|
22
|
|
|
|
|
23
|
|
|
/** |
|
24
|
|
|
* @var null|CompressionMethodManager |
|
25
|
|
|
*/ |
|
26
|
|
|
private $compressionMethodsManager = null; |
|
27
|
|
|
/** |
|
28
|
|
|
* @Given the compression methods manager factory is available |
|
29
|
|
|
*/ |
|
30
|
|
|
public function theCompressionMethodsManagerFactoryIsAvailable() |
|
31
|
|
|
{ |
|
32
|
|
|
if (false === $this->getContainer()->has(CompressionMethodManagerFactory::class)) { |
|
33
|
|
|
throw new \RuntimeException('The is no compression methods manager factory service.'); |
|
34
|
|
|
} |
|
35
|
|
|
} |
|
36
|
|
|
|
|
37
|
|
|
/** |
|
38
|
|
|
* @When I create an compression methods manager with method DEF |
|
39
|
|
|
*/ |
|
40
|
|
|
public function iCreateAnCompressionMethodsManagerWithMethodDef() |
|
41
|
|
|
{ |
|
42
|
|
|
/** @var CompressionMethodManagerFactory $factory */; |
|
43
|
|
|
$factory = $this->getContainer()->get(CompressionMethodManagerFactory::class); |
|
44
|
|
|
$this->compressionMethodsManager = $factory->create(['DEF']); |
|
45
|
|
|
} |
|
46
|
|
|
|
|
47
|
|
|
/** |
|
48
|
|
|
* @Then I should get a compression manager with method DEF |
|
49
|
|
|
*/ |
|
50
|
|
|
public function iShouldGetACompressionManagerWithMethodDef() |
|
51
|
|
|
{ |
|
52
|
|
|
if (!$this->compressionMethodsManager instanceof CompressionMethodManager) { |
|
53
|
|
|
throw new \RuntimeException(); |
|
54
|
|
|
} |
|
55
|
|
|
if (['DEF'] !== $this->compressionMethodsManager->list()) { |
|
56
|
|
|
throw new \RuntimeException(); |
|
57
|
|
|
} |
|
58
|
|
|
} |
|
59
|
|
|
} |
|
60
|
|
|
|