Completed
Pull Request — master (#15)
by John
02:38
created

OffsetDateParserTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 1
cbo 2
dl 0
loc 34
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 17 1
A testGetDateFormat() 0 4 1
A testGetText() 0 6 1
1
<?php
2
3
namespace Graze\CiffRenderer\Test;
4
5
use Graze\CiffRenderer\Field\Parser\DateParser\OffsetDateParser;
6
7
class OffsetDateParserTest extends \PHPUnit_Framework_TestCase
8
{
9
    protected $parser;
10
11
    public function setUp()
12
    {
13
        $pwd = dirname(__FILE__);
14
15
        $pathToFixture = sprintf('%s/Fixture/OffsetDateParserFixture.xml', $pwd);
16
17
        $xml = simplexml_load_file($pathToFixture);
18
19
        $pathToHeaderFixture = sprintf('%s/Fixture/OffsetDateParserHeaderFixture.xml', $pwd);
20
21
        $xmlHeader = simplexml_load_file($pathToHeaderFixture);
22
23
        $this->parser = new OffsetDateParser();
24
25
        $this->parser->setXmlField($xml);
26
        $this->parser->setXmlHeader($xmlHeader);
27
    }
28
29
    public function testGetDateFormat()
30
    {
31
        $this->assertSame("MM'/'dd'/'yy", $this->parser->getDateFormat());
32
    }
33
34
    public function testGetText()
35
    {
36
        $expected = (new \DateTime())->modify('+10 days')->format('m/d/y');
37
38
        $this->assertEquals($expected, $this->parser->getText());
39
    }
40
}
41