Passed
Push — master ( 99faad...fa79ba )
by Aimeos
13:30 queued 10:33
created

T3DatetimeTest::testReverse()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * @license LGPLv3, http://opensource.org/licenses/LGPL-3.0
5
 * @copyright Metaways Infosystems GmbH, 2013
6
 * @copyright Aimeos (aimeos.org), 2014-2022
7
 */
8
9
namespace Aimeos\Base\Criteria\Plugin;
10
11
12
/**
13
 * Test class for \Aimeos\Base\Criteria\Plugin\T3Datetime
14
 */
15
class T3DatetimeTest extends \PHPUnit\Framework\TestCase
16
{
17
	private $object;
18
19
20
	/**
21
	 * Sets up the fixture. This method is called before a test is executed.
22
	 */
23
	protected function setUp() : void
24
	{
25
		$this->object = new \Aimeos\Base\Criteria\Plugin\T3Datetime();
26
	}
27
28
29
	/**
30
	 * Tears down the fixture. This method is called after a test is executed.
31
	 */
32
	protected function tearDown() : void
33
	{
34
		unset( $this->object );
35
	}
36
37
38
	public function testTranslate()
39
	{
40
		$this->assertEquals( 3661, $this->object->translate( '1970-01-01 01:01:01' ) );
41
	}
42
43
44
	public function testTranslateNull()
45
	{
46
		$this->assertEquals( 0, $this->object->translate( null ) );
47
	}
48
49
50
	public function testTranslateNegative()
51
	{
52
		$this->assertEquals( -1, $this->object->translate( '1969-12-31 23:59:59' ) );
53
	}
54
55
56
	public function testReverse()
57
	{
58
		$this->assertEquals( '1970-01-01 01:01:01', $this->object->reverse( 3661 ) );
59
	}
60
61
62
	public function testReverseZero()
63
	{
64
		$this->assertEquals( null, $this->object->reverse( 0 ) );
65
	}
66
67
68
	public function testReverseNegative()
69
	{
70
		$this->assertEquals( '1969-12-31 23:59:59', $this->object->reverse( -1 ) );
71
	}
72
}
73