Passed
Push — extract-store ( 38a23e...9fc033 )
by Konrad
05:01
created

KeyValueBagTest::testGetSetHasEntries()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 5
nc 1
nop 0
dl 0
loc 10
rs 10
c 1
b 0
f 1
1
<?php
2
3
/*
4
 * This file is part of the sweetrdf/InMemoryStoreSqlite package and licensed under
5
 * the terms of the GPL-3 license.
6
 *
7
 * (c) Konrad Abicht <[email protected]>
8
 *
9
 * For the full copyright and license information, please view the LICENSE
10
 * file that was distributed with this source code.
11
 */
12
13
namespace Tests\Integration;
14
15
use sweetrdf\InMemoryStoreSqlite\KeyValueBag;
16
use Tests\TestCase;
17
18
class KeyValueBagTest extends TestCase
19
{
20
    private function getSubjectUnderTest(): KeyValueBag
21
    {
22
        return new KeyValueBag();
23
    }
24
25
    public function testGetSetHasEntries()
26
    {
27
        $sut = $this->getSubjectUnderTest();
28
29
        $this->assertFalse($sut->hasEntries());
30
31
        $sut->set('foo', [1]);
32
33
        $this->assertEquals([1], $sut->get('foo'));
34
        $this->assertTrue($sut->hasEntries());
35
    }
36
37
    public function testReset()
38
    {
39
        $sut = $this->getSubjectUnderTest();
40
41
        $sut->set('foo', ['bar']);
42
43
        $this->assertTrue($sut->hasEntries());
44
45
        $sut->reset();
46
47
        $this->assertFalse($sut->hasEntries());
48
    }
49
}
50