CategoryTest::testCreateCategory()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 11
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 7
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file is part of the Moo\FlashCard package.
5
 *
6
 * (c) Mohamed Alsharaf <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Moo\FlashCard\Tests\Entity;
13
14
use Moo\FlashCard\Tests\BaseTestCase;
15
16
/**
17
 * CategoryTest contains test cases for the Category entity class.
18
 *
19
 * @author Mohamed Alsharaf <[email protected]>
20
 */
21
class CategoryTest extends BaseTestCase
22
{
23
    public function testCreateCategory()
24
    {
25
        $category1 = $this->category();
26
        $category2 = $this->category([
27
            'title'  => 'Category 2',
28
            'parent' => $category1->id,
29
        ]);
30
31
        $this->assertInstanceOf('\Moo\FlashCard\Entity\Category', $category2->parent()->first());
32
        $this->assertEquals($category1->title, $category2->parent()->first()->title);
33
    }
34
35
    /**
36
     * @expectedException   \InvalidArgumentException
37
     */
38
    public function testShortCategoryTitle()
39
    {
40
        $this->category([
41
            'title' => 'Cat',
42
        ]);
43
    }
44
}
45