CompanyTest::testFindByIdReturnsCompanyModel()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 9
rs 9.6666
cc 1
eloc 6
nc 1
nop 0
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