Completed
Push — master ( 43fb10...664b94 )
by
unknown
12:57
created

CallDirectionProviderTest::testGetDate()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 0
1
<?php
2
3
namespace Oro\Bridge\CrmCall\Tests\Unit\Provider;
4
5
use Oro\Bridge\CrmCall\Provider\CallDirectionProvider;
6
use OroCRM\Bundle\CallBundle\Entity\Call;
7
use OroCRM\Bundle\CallBundle\Entity\CallDirection;
8
9
class CallDirectionProviderTest extends \PHPUnit_Framework_TestCase
10
{
11
    /** @var CallDirectionProvider */
12
    protected $provider;
13
14
    /** @var \PHPUnit_Framework_MockObject_MockObject */
15
    protected $activityManager;
16
17
    public function setUp()
18
    {
19
        $this->activityManager = $this->getMockBuilder('Oro\Bundle\ActivityBundle\Manager\ActivityManager')
20
            ->disableOriginalConstructor()
21
            ->getMock();
22
23
        $this->provider = new CallDirectionProvider($this->activityManager);
24
    }
25
26
    public function testGetSupportedClass()
27
    {
28
        $this->assertEquals('OroCRM\Bundle\CallBundle\Entity\Call', $this->provider->getSupportedClass());
29
    }
30
31
    public function testGetDirection()
32
    {
33
        $directionName = 'incoming';
34
35
        $direction = new CallDirection($directionName);
36
        $call      = new Call();
37
        $call->setDirection($direction);
38
        $this->assertEquals($directionName, $this->provider->getDirection($call, new \stdClass()));
39
    }
40
41
    public function testGetDate()
42
    {
43
        $date = new \DateTime('now', new \DateTimeZone('UTC'));
44
        $this->assertEquals($date->format('Y'), $this->provider->getDate(new Call())->format('Y'));
45
    }
46
}
47