TYPO3 CMS  TYPO3_6-2
AbstractEntityTest.php
Go to the documentation of this file.
1 <?php
3 
21 
26  $domainObjectName = $this->getUniqueId('DomainObject_');
27  $domainObjectNameWithNS = __NAMESPACE__ . '\\' . $domainObjectName;
28  eval('namespace ' . __NAMESPACE__ . '; class ' . $domainObjectName . ' extends \\TYPO3\\CMS\\Extbase\\DomainObject\\AbstractEntity {
29  public $foo;
30  public $bar;
31  }');
32  $domainObject = new $domainObjectNameWithNS();
33  $domainObject->foo = 'Test';
34  $domainObject->bar = 'It is raining outside';
35  $domainObject->_memorizeCleanState();
36  $this->assertFalse($domainObject->_isDirty());
37  }
38 
43  $domainObjectName = $this->getUniqueId('DomainObject_');
44  $domainObjectNameWithNS = __NAMESPACE__ . '\\' . $domainObjectName;
45  eval('namespace ' . __NAMESPACE__ . '; class ' . $domainObjectName . ' extends \\TYPO3\\CMS\\Extbase\\DomainObject\\AbstractEntity {
46  public $foo;
47  public $bar;
48  }');
49  $domainObject = new $domainObjectNameWithNS();
50  $domainObject->foo = 'Test';
51  $domainObject->bar = 'It is raining outside';
52  $domainObject->_memorizeCleanState();
53  $domainObject->bar = 'Now it is sunny.';
54  $this->assertTrue($domainObject->_isDirty());
55  }
56 
61  $domainObjectName = $this->getUniqueId('DomainObject_');
62  $domainObjectNameWithNS = __NAMESPACE__ . '\\' . $domainObjectName;
63  eval('namespace ' . __NAMESPACE__ . '; class ' . $domainObjectName . ' extends \\TYPO3\\CMS\\Extbase\\DomainObject\\AbstractEntity {
64  public $foo;
65  public $bar;
66  }');
67  $domainObject = new $domainObjectNameWithNS();
68  $domainObject->foo = new \DateTime();
69  $domainObject->bar = 'It is raining outside';
70  $domainObject->_memorizeCleanState();
71  $this->assertFalse($domainObject->_isDirty());
72  }
73 
78  $domainObjectName = $this->getUniqueId('DomainObject_');
79  $domainObjectNameWithNS = __NAMESPACE__ . '\\' . $domainObjectName;
80  eval('namespace ' . __NAMESPACE__ . '; class ' . $domainObjectName . ' extends \\TYPO3\\CMS\\Extbase\\DomainObject\\AbstractEntity {
81  public $foo;
82  public $bar;
83  }');
84  $secondDomainObjectName = $this->getUniqueId('DomainObject_');
85  $secondDomainObjectNameWithNS = __NAMESPACE__ . '\\' . $secondDomainObjectName;
86  eval('namespace ' . __NAMESPACE__ . '; class ' . $secondDomainObjectName . ' extends \\TYPO3\\CMS\\Extbase\\DomainObject\\AbstractEntity {
87  public $foo;
88  public $bar;
89  }');
90  $secondDomainObject = new $secondDomainObjectNameWithNS();
91  $secondDomainObject->_memorizeCleanState();
92  $domainObject = new $domainObjectNameWithNS();
93  $domainObject->foo = $secondDomainObject;
94  $domainObject->bar = 'It is raining outside';
95  $domainObject->_memorizeCleanState();
96  $this->assertFalse($domainObject->_isDirty());
97  }
98 }