-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathStorageTest.php
More file actions
54 lines (43 loc) · 1.21 KB
/
StorageTest.php
File metadata and controls
54 lines (43 loc) · 1.21 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
declare(strict_types=1);
namespace PHPFluent\ArrayStorage;
use PHPUnit\Framework\TestCase;
use function iterator_to_array;
/**
* @covers PHPFluent\ArrayStorage\Storage
*/
class StorageTest extends TestCase
{
public function testShouldGetCollectionWhenPropertyDoesNoExists(): void
{
$storage = new Storage();
$collection = $storage->whatever;
$this->assertInstanceOf(Collection::class, $collection);
}
public function testShouldUseFactoryToCreateCollections(): void
{
$factory = $this
->getMockBuilder(Factory::class)
->disableOriginalConstructor()
->getMock();
$factory
->expects($this->once())
->method('collection');
$storage = new Storage($factory);
$storage->whatever;
}
public function testShouldCountCollections(): void
{
$storage = new Storage();
$storage->foo;
$storage->bar;
$this->assertCount(2, $storage);
}
public function testShouldIterateOverCollections(): void
{
$storage = new Storage();
$storage->foo;
$storage->bar;
$this->assertCount(2, iterator_to_array($storage));
}
}