‪TYPO3CMS  9.5
AbstractEntityTest.php
Go to the documentation of this file.
1 <?php
2 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 
18 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
19 
23 class ‪AbstractEntityTest extends UnitTestCase
24 {
29  {
30  $domainObject = new class extends \‪TYPO3\CMS\‪Extbase\DomainObject\AbstractEntity {
31  public $foo = 'Test';
32  public $bar = 'It is raining outside';
33  };
34  $domainObject->_memorizeCleanState();
35 
36  $this->assertFalse($domainObject->_isDirty());
37  }
38 
43  {
44  $domainObject = new class extends \‪TYPO3\CMS\‪Extbase\DomainObject\AbstractEntity {
45  public $foo = 'Test';
46  public $bar = 'It is raining outside';
47  };
48  $domainObject->_memorizeCleanState();
49  $domainObject->bar = 'Now it is sunny.';
50 
51  $this->assertTrue($domainObject->_isDirty());
52  }
53 
58  {
59  $domainObject = new class extends \‪TYPO3\CMS\‪Extbase\DomainObject\AbstractEntity {
60  public $foo;
61  public $bar = 'It is raining outside';
62  };
63  $domainObject->foo = new \DateTime();
64  $domainObject->_memorizeCleanState();
65 
66  $this->assertFalse($domainObject->_isDirty());
67  }
68 
73  {
74  $domainObject = new class extends \‪TYPO3\CMS\‪Extbase\DomainObject\AbstractEntity {
75  public $foo;
76  public $bar;
77  };
78 
79  $secondDomainObject = new class extends \‪TYPO3\CMS\‪Extbase\DomainObject\AbstractEntity {
80  public $foo;
81  public $bar;
82  };
83 
84  $secondDomainObject->_memorizeCleanState();
85  $domainObject->foo = $secondDomainObject;
86  $domainObject->bar = 'It is raining outside';
87  $domainObject->_memorizeCleanState();
88 
89  $this->assertFalse($domainObject->_isDirty());
90  }
91 }
‪TYPO3\CMS\Extbase\Annotation
Definition: IgnoreValidation.php:4
‪TYPO3\CMS\Extbase\Tests\Unit\DomainObject
Definition: AbstractEntityTest.php:3
‪TYPO3
‪TYPO3\CMS\Extbase\Tests\Unit\DomainObject\AbstractEntityTest\objectIsNotDirtyAfterCallingMemorizeCleanStateWithObjectProperties
‪objectIsNotDirtyAfterCallingMemorizeCleanStateWithObjectProperties()
Definition: AbstractEntityTest.php:57
‪TYPO3\CMS\Extbase\Tests\Unit\DomainObject\AbstractEntityTest\objectIsNotDirtyAfterCallingMemorizeCleanStateWithSimpleProperties
‪objectIsNotDirtyAfterCallingMemorizeCleanStateWithSimpleProperties()
Definition: AbstractEntityTest.php:28
‪TYPO3\CMS\Extbase\Tests\Unit\DomainObject\AbstractEntityTest
Definition: AbstractEntityTest.php:24
‪TYPO3\CMS\Extbase\Tests\Unit\DomainObject\AbstractEntityTest\objectIsDirtyAfterCallingMemorizeCleanStateWithSimplePropertiesAndModifyingThePropertiesAfterwards
‪objectIsDirtyAfterCallingMemorizeCleanStateWithSimplePropertiesAndModifyingThePropertiesAfterwards()
Definition: AbstractEntityTest.php:42
‪TYPO3\CMS\Extbase\Tests\Unit\DomainObject\AbstractEntityTest\objectIsNotDirtyAfterCallingMemorizeCleanStateWithOtherDomainObjectsAsProperties
‪objectIsNotDirtyAfterCallingMemorizeCleanStateWithOtherDomainObjectsAsProperties()
Definition: AbstractEntityTest.php:72