Completed
Branch master (beb88f)
by Mohamed
05:11 queued 03:39
created

CategoryTest::testShortCategoryTitle()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
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
15
use Moo\FlashCard\Tests\BaseTestCase;
16
17
/**
18
 * CategoryTest contains test cases for the Category entity class.
19
 *
20
 * @author Mohamed Alsharaf <[email protected]>
21
 */
22
class CategoryTest extends BaseTestCase
23
{
24
    public function testCreateCategory()
25
    {
26
        $category1 = $this->category();
27
        $category2 = $this->category([
28
            'title' => 'Category 2',
29
            'parent' => $category1->id,
30
        ]);
31
32
        $this->assertInstanceOf('\Moo\FlashCard\Entity\Category', $category2->parent()->first());
33
        $this->assertEquals($category1->title, $category2->parent()->first()->title);
34
    }
35
36
    /**
37
     * @expectedException   InvalidArgumentException
38
     */
39
    public function testShortCategoryTitle()
40
    {
41
        $this->category([
42
            'title' => 'Cat',
43
        ]);
44
    }
45
}
46