1 | <?php |
||
16 | class AbstractEntityTest extends TestCase |
||
17 | { |
||
18 | public function testUuid() |
||
19 | { |
||
20 | $uuid = Uuid::uuid4(); |
||
21 | |||
22 | /** @var AbstractEntity $entity */ |
||
23 | $entity = $this->getMockForAbstractClass(AbstractEntity::class, [ $uuid ]); |
||
24 | |||
25 | $this->assertEquals($uuid, $entity->getUuid()); |
||
26 | } |
||
27 | |||
28 | public function testUuidIsAutomaticallyGenerated() |
||
29 | { |
||
30 | /** @var AbstractEntity $entity */ |
||
31 | $entity = $this->getMockForAbstractClass(AbstractEntity::class); |
||
32 | |||
33 | $this->assertNotEmpty($entity->getUuid()); |
||
34 | $this->assertTrue(Uuid::isValid($entity->getUuid())); |
||
35 | } |
||
36 | |||
37 | public function testUuidFromString() |
||
38 | { |
||
39 | $uuid = Uuid::uuid4()->toString(); |
||
40 | |||
41 | /** @var AbstractEntity $entity */ |
||
42 | $entity = $this->getMockForAbstractClass(AbstractEntity::class, [ $uuid ]); |
||
43 | |||
44 | $this->assertSame($uuid, $entity->getUuid()); |
||
45 | } |
||
46 | |||
47 | public function testCloningChangesUuid() |
||
54 | |||
55 | public function testCloningDoesntRefreshUuidIfWasntSet() |
||
64 | } |
||
65 |