CompanyTest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2
Metric Value
wmc 3
lcom 1
cbo 2
dl 0
loc 28
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getMapper() 0 4 1
A testFindByIdReturnsCompanyModel() 0 9 1
A testGetAllReturnsArrayOfCompanies() 0 10 1
1
<?php
2
3
namespace SpeckCatalogTest\Mapper;
4
5
use SpeckCatalogTest\Mapper\TestAsset\AbstractTestCase;
6
7
class CompanyTest extends AbstractTestCase
8
{
9
    public function testFindByIdReturnsCompanyModel()
10
    {
11
        $testMapper = $this->getTestMapper();
12
        $testMapper->insert(array('company_id' => 1, 'name' => 'company'), 'contact_company');
13
14
        $mapper = $this->getMapper();
15
        $result = $mapper->findById(1);
16
        $this->assertTrue($result instanceof \SpeckCatalog\Model\Company);
17
    }
18
19
    public function getMapper()
20
    {
21
        return $this->getServiceManager()->get('speckcatalog_company_mapper');
22
    }
23
24
    public function testGetAllReturnsArrayOfCompanies()
25
    {
26
        $testMapper = $this->getTestMapper();
27
        $testMapper->insert(array('company_id' => 1, 'name' => 'company'), 'contact_company');
28
29
        $mapper = $this->getMapper();
30
        $result = $mapper->getAll();
31
        $this->assertTrue(is_array($result));
32
        $this->assertInstanceOf('\SpeckCatalog\Model\Company', $result[0]);
33
    }
34
}
35