ArticleTest::testGetHeadingMethod()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 8
rs 9.4286
cc 1
eloc 5
nc 1
nop 0
1
<?php
2
3
/**
4
 * This file is part of the Axstrad library.
5
 *
6
 * (c) Dan Kempster <[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
 * @copyright 2014-2015 Dan Kempster <[email protected]>
12
 */
13
14
namespace Axstrad\Component\Content\Tests\Unit\Model;
15
16
use Axstrad\Component\Content\Model\Article;
17
18
/**
19
 * Axstrad\Component\Content\Tests\Unit\Model\ArticleTest
20
 *
21
 * @author Dan Kempster <[email protected]>
22
 * @license MIT
23
 * @package Axstrad/Content
24
 * @subpackage Tests
25
 * @group unit
26
 */
27
class ArticleTest extends \PHPUnit_Framework_TestCase
28
{
29
    /**
30
     * @var Article
31
     */
32
    protected $fixture;
33
34
    public function setUp()
35
    {
36
        $this->fixture = new Article;
37
    }
38
39
    /**
40
     */
41
    public function testCopyIsNullToStart()
42
    {
43
        $this->assertAttributeEquals(
44
            null,
45
            'copy',
46
            $this->fixture
47
        );
48
    }
49
50
    /**
51
     * @covers Axstrad\Component\Content\Model\Article::setHeading
52
     */
53
    public function testCanSetHeading()
54
    {
55
        $this->fixture->setHeading('A New Heading.');
56
        $this->assertAttributeEquals(
57
            'A New Heading.',
58
            'heading',
59
            $this->fixture
60
        );
61
    }
62
63
    /**
64
     * @covers Axstrad\Component\Content\Model\Article::setHeading
65
     */
66
    public function testSetHeadingReturnsSelf()
67
    {
68
        $this->assertSame(
69
            $this->fixture,
70
            $this->fixture->setHeading('')
71
        );
72
    }
73
74
    /**
75
     * @covers Axstrad\Component\Content\Model\Article::getHeading
76
     * @depends testCanSetHeading
77
     * @uses Axstrad\Component\Content\Model\Article::setHeading
78
     */
79
    public function testGetHeadingMethod()
80
    {
81
        $this->fixture->setHeading('A Another Heading.');
82
        $this->assertSame(
83
            'A Another Heading.',
84
            $this->fixture->getHeading()
85
        );
86
    }
87
}
88