FeatureTest::getMapper()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace SpeckCatalogTest\Mapper;
4
5
use SpeckCatalogTest\Mapper\TestAsset\AbstractTestCase;
6
7
class FeatureTest extends AbstractTestCase
8
{
9
    //temp method just to include this mapper
10
    public function testInstantiate()
11
    {
12
        $mapper = $this->getMapper();
13
        $this->assertTrue($mapper instanceof \SpeckCatalog\Mapper\Feature);
14
    }
15
16
    public function testGetByProductIdReturnsArrayOfFeatureModels()
17
    {
18
        $testMapper = $this->getTestMapper();
19
        $testMapper->insert(array('product_id' => 88), 'catalog_product_feature');
20
21
        $mapper = $this->getMapper();
22
        $return = $mapper->getByProductId(88);
23
        $this->assertTrue(is_array($return));
24
        $this->assertInstanceOf('\SpeckCatalog\Model\Feature', $return[0]);
25
    }
26
27
    public function getMapper()
28
    {
29
        return $this->getServiceManager()->get('speckcatalog_feature_mapper');
30
    }
31
}
32