9
9
namespace App \Tests \Integration \Entity ;
10
10
11
11
use App \Entity \DateDimension ;
12
- use App \ Utils \ Tests \ PhpUnitUtil ;
12
+ use DateTime ;
13
13
use DateTimeImmutable ;
14
- use Throwable ;
15
- use function in_array ;
16
- use function ucfirst ;
14
+ use DateTimeZone ;
17
15
18
16
/**
19
17
* Class DateDimensionTest
@@ -29,59 +27,17 @@ class DateDimensionTest extends EntityTestCase
29
27
* @var class-string
30
28
*/
31
29
protected string $ entityName = DateDimension::class;
32
-
33
- /** @noinspection PhpMissingParentCallCommonInspection */
34
- /**
35
- * @testdox No setter for `$property` property in read only entity - so cannot test this
36
- */
37
- public function testThatSetterOnlyAcceptSpecifiedType (
38
- ?string $ property = null ,
39
- ?string $ type = null ,
40
- ?array $ meta = null ,
41
- ): void {
42
- self ::markTestSkipped ('There is not setter in read only entity... ' );
43
- }
44
-
45
- /** @noinspection PhpMissingParentCallCommonInspection */
46
- /**
47
- * @testdox No setter for `$property` property in read only entity - so cannot test this
48
- */
49
- public function testThatSetterReturnsInstanceOfEntity (
50
- ?string $ property = null ,
51
- ?string $ type = null ,
52
- ?array $ meta = null
53
- ): void {
54
- self ::markTestSkipped ('There is not setter in read only entity... ' );
55
- }
56
-
57
- /** @noinspection PhpMissingParentCallCommonInspection */
58
- /**
59
- * @dataProvider dataProviderTestThatSetterAndGettersWorks
60
- *
61
- * @throws Throwable
62
- *
63
- * @testdox Test that getter method for `$type $property` property returns expected
64
- */
65
- public function testThatGetterReturnsExpectedValue (string $ property , string $ type , array $ meta ): void
30
+
31
+ public function testThatGetCreatedAtMethodReturnsExpected (): void
66
32
{
67
- $ getter = 'get ' . ucfirst ($ property );
68
-
69
- if (in_array ($ type , [PhpUnitUtil::TYPE_BOOL , PhpUnitUtil::TYPE_BOOLEAN ], true )) {
70
- $ getter = 'is ' . ucfirst ($ property );
71
- }
72
-
73
- $ dateDimension = $ this ->createEntity ();
74
-
75
- try {
76
- $ method = 'assertIs ' . ucfirst ($ type );
77
-
78
- self ::$ method ($ dateDimension ->{$ getter }());
79
- } catch (Throwable $ error ) {
80
- /**
81
- * @var class-string $type
82
- */
83
- self ::assertInstanceOf ($ type , $ dateDimension ->{$ getter }(), $ error ->getMessage ());
84
- }
33
+ $ entity = $ this ->createEntity ();
34
+ $ createdAt = $ entity ->getCreatedAt ();
35
+
36
+ self ::assertEqualsWithDelta (
37
+ (new DateTime ('now ' , new DateTimeZone ('utc ' )))->getTimestamp (),
38
+ $ createdAt ->getTimestamp (),
39
+ 1
40
+ );
85
41
}
86
42
87
43
/**
0 commit comments