DateTypeTest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
wmc 3
c 0
b 0
f 0
lcom 1
cbo 3
dl 0
loc 30
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 6 1
A testConvertToPHPValue() 0 5 1
A testGetName() 0 4 1
1
<?php
2
3
namespace JhFlexiTimeTest\DBAL\Types;
4
5
use Doctrine\DBAL\Platforms\MySQL57Platform;
6
use JhFlexiTime\DBAL\Types\DateType;
7
use PHPUnit_Framework_TestCase;
8
use Doctrine\DBAL\Types\Type;
9
use Doctrine\Tests\DBAL\Mocks\MockPlatform;
10
11
/**
12
 * Class DateTypeTest
13
 * @package JhFlexiTimeTest\DBAL\Types
14
 * @author  Aydin Hassan <[email protected]>
15
 */
16
class DateTypeTest extends PHPUnit_Framework_TestCase
17
{
18
    /**
19
     * @var Type
20
     */
21
    protected $type;
22
23
    /**
24
     * @var MySQL57Platform
25
     */
26
    protected $platform;
27
28
    public function setUp()
29
    {
30
        Type::overrideType('date', 'JhFlexiTime\DBAL\Types\DateType');
31
        $this->type       = Type::getType('date');
32
        $this->platform   = new MySQL57Platform;
33
    }
34
35
    public function testConvertToPHPValue()
36
    {
37
        $dateTime = $this->type->convertToPHPValue('2014-01-02', $this->platform);
38
        $this->assertInstanceOf('JhFlexiTime\DateTime\DateTime', $dateTime);
39
    }
40
41
    public function testGetName()
42
    {
43
        $this->assertEquals('date', $this->type->getName());
44
    }
45
}
46