#63943PHPUnit-Tests fail on Windows
Description
Executing the PHPUnit-Tests on Windows is not possible currently:
Fatal error: Cannot redeclare class TYPO3\CMS\Extbase\Tests\Unit\DomainObject\DomainObject_5490aef9162dd in D:\typo3\master\typo3\sysext\extbase\Tests\Unit\DomainObject\AbstractEntityTest.php(89) : eval()'d code on line 4
This is due to
$domainObjectName = uniqid('DomainObject_');
$domainObjectNameWithNS = __NAMESPACE__ . '\\' . $domainObjectName;
eval('namespace ' . __NAMESPACE__ . '; class ' . $domainObjectName . ' extends \\' . \TYPO3\CMS\Extbase\DomainObject\AbstractEntity::class . ' {
public $foo;
public $bar;
}');
$secondDomainObjectName = uniqid('DomainObject_');
$secondDomainObjectNameWithNS = __NAMESPACE__ . '\\' . $secondDomainObjectName;
eval('namespace ' . __NAMESPACE__ . '; class ' . $secondDomainObjectName . ' extends \\' . \TYPO3\CMS\Extbase\DomainObject\AbstractEntity::class . ' {
public $foo;
public $bar;
}');
On windows the calls
$domainObjectName = uniqid('DomainObject_');
$secondDomainObjectName = uniqid('DomainObject_');
return the same id, which is related to #59701, #58602 and #59055.
Using
$domainObjectName = 'DomainObject_' . md5(uniqid(microtime(), true));
solves the issue.
Reviews 2
Related issues 6
- Bug #58602Datepicker issue on multiple datetime fields in BE
- Bug #59055Import from .t3d failed on Windows 7 with a lot of messages
- Bug #59701uniqid() not returning unique values
- Bug #64055PHPUnit-Tests fail on Windows (2)
- Bug #69039Functional Tests: NEWid generation in tests does not match core
- Task #69050Supply a Utility method to create unique ids in the core