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

CategoryTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 2
dl 0
loc 24
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testCreateCategory() 0 11 1
A testShortCategoryTitle() 0 6 1
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