-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathOptionsBagTest.php
More file actions
54 lines (43 loc) · 1.4 KB
/
Copy pathOptionsBagTest.php
File metadata and controls
54 lines (43 loc) · 1.4 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
<?php
namespace Bolt\Session\Tests;
use Bolt\Session\OptionsBag;
use PHPUnit\Framework\TestCase;
use Symfony\Component\HttpFoundation\ParameterBag;
/**
* Class to test src/OptionsBag.
*
* @author Gawain Lynch <gawain.lynch@gmail.com>
*/
class OptionsBagTest extends TestCase
{
public function testInstanceOf()
{
$bag = new OptionsBag();
$this->assertInstanceOf(ParameterBag::class, $bag);
}
public function testGet()
{
$bag = new OptionsBag(['antistatic' => 'polyethylene terephthalate']);
$this->assertObjectHasAttribute('parameters', $bag);
$this->assertTrue($bag->has('antistatic'));
$this->assertSame('polyethylene terephthalate', $bag->get('antistatic'));
}
public function testOffsetExists()
{
$bag = new OptionsBag(['antistatic' => 'polyethylene terephthalate']);
$this->assertTrue($bag->offsetExists('antistatic'));
}
public function testOffsetSet()
{
$bag = new OptionsBag();
$bag->offsetSet('antistatic', 'polyethylene terephthalate');
$this->assertTrue($bag->offsetExists('antistatic'));
}
public function testOffsetUnset()
{
$bag = new OptionsBag(['antistatic' => 'polyethylene terephthalate']);
$this->assertTrue($bag->has('antistatic'));
$bag->offsetUnset('antistatic');
$this->assertFalse($bag->has('antistatic'));
}
}