Completed
Pull Request — develop (#25)
by Axel
08:24
created

ProjectModelTest::testModel()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 31
Code Lines 29

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 31
rs 8.8571
cc 1
eloc 29
nc 1
nop 0
1
<?php
2
3
namespace Developtech\AgilityBundle\Tests\Model;
4
5
use Developtech\AgilityBundle\Tests\Mock\Project;
6
use Developtech\AgilityBundle\Tests\Mock\Feature;
7
use Developtech\AgilityBundle\Tests\Mock\Feedback;
8
9
class ProjectModelTest extends \PHPUnit_Framework_TestCase {
10
    public function testModel() {
11
        $feedback = new Feedback();
12
        $feature = new Feature();
13
        $entity =
14
            (new Project())
15
            ->setId(1)
16
            ->setName('Great project')
17
            ->setSlug('great-project')
18
            ->setCreatedAt(new \DateTime())
19
            ->setProductOwner((new \StdClass()))
20
            ->setBetaTestStatus('open')
21
            ->setNbBetaTesters(12)
22
            ->addFeature(new Feature())
23
            ->addFeature($feature)
24
            ->removeFeature($feature)
25
            ->addFeedback($feedback)
26
            ->addFeedback(new Feedback())
27
            ->removeFeedback($feedback)
28
        ;
29
        $this->assertEquals(1, $entity->getId());
30
        $this->assertEquals('Great project', $entity->getName());
31
        $this->assertEquals('great-project', $entity->getSlug());
32
        $this->assertInstanceOf('DateTime', $entity->getCreatedAt());
33
        $this->assertInstanceOf('StdClass', $entity->getProductOwner());
34
        $this->assertEquals('open', $entity->getBetaTestStatus());
35
        $this->assertEquals(12, $entity->getNbBetaTesters());
36
        $this->assertFalse($project->hasFeature($feature));
0 ignored issues
show
Bug introduced by
The variable $project does not exist. Did you forget to declare it?

This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.

Loading history...
37
        $this->assertFalse($project->hasFeedback($feedback));
38
        $this->assertCount(1, $project->getFeedbacks());
39
        $this->assertCount(1, $project->getFeatures());
40
    }
41
}
42