CategoryTest   A
last analyzed

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
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