Skip to content

Commit d8b38dd

Browse files
committed
DefaultFixture testing helper added
1 parent 75e1684 commit d8b38dd

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

src/Test/DefaultFixture.php

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
3+
namespace ViewComponents\TestingHelpers\Test;
4+
use Nayjest\Collection\Extended\ObjectCollection;
5+
6+
class DefaultFixture
7+
{
8+
private static $data;
9+
10+
public static function getArray()
11+
{
12+
if (self::$data === null) {
13+
self::$data = include TESTING_HELPERS_DIR . '/resources/fixtures/users.php';
14+
}
15+
return self::$data;
16+
}
17+
18+
public static function getObjects()
19+
{
20+
$objects = [];
21+
foreach(self::getArray() as $arrayItem) {
22+
$objects[] = (object)$arrayItem;
23+
}
24+
return $objects;
25+
}
26+
27+
public static function getCollection()
28+
{
29+
return new ObjectCollection(self::getObjects());
30+
}
31+
}

0 commit comments

Comments
 (0)