-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBookmarkTest.php
72 lines (58 loc) · 1.66 KB
/
BookmarkTest.php
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<?php
declare(strict_types=1);
namespace Tleckie\Translate\Tests;
use ArrayIterator;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
use Tleckie\Translate\Bookmark;
use Tleckie\Translate\Bookmark\BookmarkInterface;
use Tleckie\Translate\Catalogue\CatalogueInterface;
use Tleckie\Translate\Loader\LoaderInterface;
/**
* Class BookmarkTest
*
* @package Tleckie\Translate\Tests
* @category BookmarkTest
* @author Teodoro Leckie Westberg <teodoroleckie@gmail.com>
*/
class BookmarkTest extends TestCase
{
/**
* @var ArrayIterator|MockObject
*/
protected ArrayIterator|MockObject $catalogsMock;
/**
* @var LoaderInterface|MockObject
*/
protected LoaderInterface|MockObject $loaderMock;
/**
* @var BookmarkInterface
*/
protected BookmarkInterface $bookmark;
/**
* @test
*/
public function check(): void
{
static::assertInstanceOf(
BookmarkInterface::class,
$this->bookmark->setLoader($this->loaderMock)
);
static::assertFalse($this->bookmark->hasCatalogue('es_ES'));
$this->loaderMock
->expects(static::once())
->method('load')
->willReturn(['test' => 'pruebas']);
static::assertInstanceOf(
CatalogueInterface::class,
$this->bookmark->getCatalogue('es_ES')
);
$this->bookmark->getCatalogue('es_ES');
}
protected function setUp(): void
{
$this->catalogsMock = $this->createMock(ArrayIterator::class);
$this->loaderMock = $this->createMock(LoaderInterface::class);
$this->bookmark = new Bookmark();
}
}