-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathConfigurableDbalProtocolTest.php
More file actions
67 lines (56 loc) · 1.88 KB
/
ConfigurableDbalProtocolTest.php
File metadata and controls
67 lines (56 loc) · 1.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<?php
namespace Smartbox\Integration\FrameworkBundle\Tests\Unit\Components\Db\Dbal;
use Smartbox\Integration\FrameworkBundle\Components\DB\Dbal\ConfigurableDbalProtocol;
use Symfony\Component\OptionsResolver\OptionsResolver;
/**
* Class RestConfigurableProducerTest.
*/
class ConfigurableDbalProtocolTest extends \PHPUnit\Framework\TestCase
{
/**
* @var ConfigurableDbalProtocol
*/
private $dbalProtocol;
/**
* @var array
*/
private $expectedOptions;
protected function setUp(): void
{
$this->dbalProtocol = new ConfigurableDbalProtocol();
$this->expectedOptions = [
ConfigurableDbalProtocol::OPTION_METHOD,
ConfigurableDbalProtocol::OPTION_STOP_ON_NO_RESULTS,
ConfigurableDbalProtocol::OPTION_DB_CONNECTION_NAME,
ConfigurableDbalProtocol::OPTION_SLEEP_TIME,
ConfigurableDbalProtocol::OPTION_INACTIVITY_TRIGGER,
ConfigurableDbalProtocol::OPTION_ALWAYS_SLEEP,
];
}
protected function tearDown(): void
{
$this->dbalProtocol = null;
$this->expectedOptions = null;
}
/**
* Method to test the options descriptions available for this protocol.
*/
public function testGetOptionsDescriptions()
{
$options = $this->dbalProtocol->getOptionsDescriptions();
foreach ($this->expectedOptions as $expectedOption) {
$this->assertArrayHasKey($expectedOption, $options);
}
}
/**
* Method to test if the options resolver is configured with the expected options.
*/
public function testConfigureOptionsResolver()
{
$resolver = new OptionsResolver();
$this->dbalProtocol->configureOptionsResolver($resolver);
foreach ($this->expectedOptions as $expectedOption) {
$this->assertTrue($resolver->isDefined($expectedOption));
}
}
}