Passed
Push — master ( 343fce...2eecbd )
by Victor
02:39
created

testGetAttributesShouldReturnAllAttributes()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
eloc 1
nc 1
nop 0
1
<?php
2
declare(strict_types=1);
3
4
namespace Shoot\Shoot\Tests;
5
6
use PHPUnit\Framework\TestCase;
7
use Shoot\Shoot\Context;
8
9
final class ContextTest extends TestCase
10
{
11
    /** @var Context */
12
    private $context;
13
14
    /**
15
     * @return void
16
     */
17
    protected function setUp()
18
    {
19
        $this->context = new Context([
20
            'null_attribute' => null,
21
            'string_attribute' => 'value',
22
        ]);
23
    }
24
25
    /**
26
     * @return void
27
     */
28
    public function testGetAttributeShouldReturnGivenDefaultValueIfAttributeDoesNotExist()
29
    {
30
        $this->assertSame('default', $this->context->getAttribute('non_existing_attribute', 'default'));
31
    }
32
33
    /**
34
     * @return void
35
     */
36
    public function testGetAttributeShouldReturnValueIfAttributeExists()
37
    {
38
        $this->assertSame('value', $this->context->getAttribute('string_attribute'));
39
    }
40
}
41