1 | <?php |
||
9 | class Library extends atoum |
||
10 | { |
||
11 | public function testConstruct() |
||
12 | { |
||
13 | $library = new BaseLibrary([]); |
||
14 | |||
15 | $this |
||
16 | ->array($library->getAllPosts()) |
||
17 | ->isEmpty(); |
||
18 | } |
||
19 | |||
20 | public function testConstructWithPosts() |
||
21 | { |
||
22 | $posts = PostTest::buildPostMocks(3); |
||
23 | |||
24 | $library = new BaseLibrary($posts); |
||
25 | |||
26 | $this |
||
27 | ->array($library->getAllPosts()) |
||
28 | ->isEqualTo($posts); |
||
29 | } |
||
30 | |||
31 | public function testAddPost() |
||
32 | { |
||
33 | $library = new BaseLibrary([]); |
||
34 | |||
35 | $this->boolean($library->isPostRegistered('A')) |
||
36 | ->isFalse(); |
||
37 | |||
38 | $post = new \mock\Matks\MarkdownBlogBundle\Blog\Post( |
||
39 | PostTest::getLoremIpsumFilepath(), 'A', '2016-01-02'); |
||
40 | |||
41 | $library->addPost($post); |
||
42 | |||
43 | $this->boolean($library->isPostRegistered('A')) |
||
44 | ->isTrue(); |
||
45 | $this->object($library->getPostByName('A')) |
||
46 | ->isIdentiCalTo($post); |
||
47 | } |
||
48 | } |
||
49 |