QueryTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testCreateDate() 0 15 1
A testCreateDateException() 0 4 1
1
<?php
2
3
namespace Pouzor\MongoDBBundle\Tests\Unit\Services;
4
5
use Pouzor\MongoDBBundle\Constants\DriverClasses;
6
use Pouzor\MongoDBBundle\Constants\Query;
7
8
class QueryTest extends \PHPUnit_Framework_TestCase
9
{
10
11
    public function testCreateDate()
12
    {
13
        $time = Query::createDate(null);
14
        $this->assertEquals(get_class($time), DriverClasses::DATE_CLASS);
15
16
        $timestamp = time();
17
18
        $time = Query::createDate($timestamp);
19
        $this->assertEquals(get_class($time), DriverClasses::DATE_CLASS);
20
        $this->assertEquals($time->toDateTime()->getTimestamp(), $timestamp);
21
22
        $time = Query::createDate("2017-01-01T00:00:00");
23
        $this->assertEquals(strtotime("2017-01-01T00:00:00"), $time->toDateTime()->getTimestamp());
24
25
    }
26
27
    /**
28
     * @expectedException Exception
29
     */
30
    public function testCreateDateException()
31
    {
32
        $this->expectException(Query::createDate("bla"));
33
    }
34
}