‪TYPO3CMS  10.4
AbstractEntityTest.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
19 
21 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
22 
26 class ‪AbstractEntityTest extends UnitTestCase
27 {
32  {
33  $domainObject = new class() extends ‪AbstractEntity {
34  public $foo = 'Test';
35  public $bar = 'It is raining outside';
36  };
37  $domainObject->‪_memorizeCleanState();
38 
39  self::assertFalse($domainObject->_isDirty());
40  }
41 
46  {
47  $domainObject = new class() extends ‪AbstractEntity {
48  public $foo = 'Test';
49  public $bar = 'It is raining outside';
50  };
51  $domainObject->‪_memorizeCleanState();
52  $domainObject->bar = 'Now it is sunny.';
53 
54  self::assertTrue($domainObject->_isDirty());
55  }
56 
61  {
62  $domainObject = new class() extends ‪AbstractEntity {
63  public $foo;
64  public $bar = 'It is raining outside';
65  };
66  $domainObject->foo = new \DateTime();
67  $domainObject->_memorizeCleanState();
68 
69  self::assertFalse($domainObject->_isDirty());
70  }
71 
76  {
77  $domainObject = new class() extends ‪AbstractEntity {
78  public $foo;
79  public $bar;
80  };
81 
82  $secondDomainObject = new class() extends ‪AbstractEntity {
83  public $foo;
84  public $bar;
85  };
86 
87  $secondDomainObject->‪_memorizeCleanState();
88  $domainObject->foo = $secondDomainObject;
89  $domainObject->bar = 'It is raining outside';
90  $domainObject->_memorizeCleanState();
91 
92  self::assertFalse($domainObject->_isDirty());
93  }
94 }
‪TYPO3\CMS\Extbase\DomainObject\AbstractDomainObject\_memorizeCleanState
‪_memorizeCleanState($propertyName=null)
Definition: AbstractDomainObject.php:173
‪TYPO3\CMS\Extbase\Tests\Unit\DomainObject
Definition: AbstractEntityTest.php:18
‪TYPO3\CMS\Extbase\Tests\Unit\DomainObject\AbstractEntityTest\objectIsNotDirtyAfterCallingMemorizeCleanStateWithObjectProperties
‪objectIsNotDirtyAfterCallingMemorizeCleanStateWithObjectProperties()
Definition: AbstractEntityTest.php:60
‪TYPO3\CMS\Extbase\DomainObject\AbstractEntity
Definition: AbstractEntity.php:23
‪TYPO3\CMS\Extbase\Tests\Unit\DomainObject\AbstractEntityTest\objectIsNotDirtyAfterCallingMemorizeCleanStateWithSimpleProperties
‪objectIsNotDirtyAfterCallingMemorizeCleanStateWithSimpleProperties()
Definition: AbstractEntityTest.php:31
‪TYPO3\CMS\Extbase\Tests\Unit\DomainObject\AbstractEntityTest
Definition: AbstractEntityTest.php:27
‪TYPO3\CMS\Extbase\Tests\Unit\DomainObject\AbstractEntityTest\objectIsDirtyAfterCallingMemorizeCleanStateWithSimplePropertiesAndModifyingThePropertiesAfterwards
‪objectIsDirtyAfterCallingMemorizeCleanStateWithSimplePropertiesAndModifyingThePropertiesAfterwards()
Definition: AbstractEntityTest.php:45
‪TYPO3\CMS\Extbase\Tests\Unit\DomainObject\AbstractEntityTest\objectIsNotDirtyAfterCallingMemorizeCleanStateWithOtherDomainObjectsAsProperties
‪objectIsNotDirtyAfterCallingMemorizeCleanStateWithOtherDomainObjectsAsProperties()
Definition: AbstractEntityTest.php:75