17 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
29 $this->expectException(\UnexpectedValueException::class);
30 $this->expectExceptionCode(1381597631);
31 $identifier = $this->getUniqueId(
'identifier__');
32 new \TYPO3\CMS\Backend\View\BackendLayout\BackendLayoutCollection($identifier);
40 $identifier = $this->getUniqueId(
'identifier');
41 $backendLayoutCollection = new \TYPO3\CMS\Backend\View\BackendLayout\BackendLayoutCollection($identifier);
43 $this->assertEquals($identifier, $backendLayoutCollection->getIdentifier());
51 $this->expectException(\UnexpectedValueException::class);
52 $this->expectExceptionCode(1381597628);
53 $identifier = $this->getUniqueId(
'identifier');
54 $backendLayoutCollection = new \TYPO3\CMS\Backend\View\BackendLayout\BackendLayoutCollection($identifier);
55 $backendLayoutIdentifier = $this->getUniqueId(
'identifier__');
56 $backendLayoutMock = $this->getMockBuilder(\
TYPO3\CMS\Backend\View\BackendLayout\BackendLayout::class)
57 ->setMethods([
'getIdentifier'])
58 ->disableOriginalConstructor()
60 $backendLayoutMock->expects($this->once())->method(
'getIdentifier')->will($this->returnValue($backendLayoutIdentifier));
62 $backendLayoutCollection->add($backendLayoutMock);
70 $this->expectException(\LogicException::class);
71 $this->expectExceptionCode(1381559376);
72 $identifier = $this->getUniqueId(
'identifier');
73 $backendLayoutCollection = new \TYPO3\CMS\Backend\View\BackendLayout\BackendLayoutCollection($identifier);
74 $backendLayoutIdentifier = $this->getUniqueId(
'identifier');
75 $firstBackendLayoutMock = $this->getMockBuilder(\
TYPO3\CMS\Backend\View\BackendLayout\BackendLayout::class)
76 ->setMethods([
'getIdentifier'])
77 ->disableOriginalConstructor()
79 $firstBackendLayoutMock->expects($this->once())->method(
'getIdentifier')->will($this->returnValue($backendLayoutIdentifier));
80 $secondBackendLayoutMock = $this->getMockBuilder(\
TYPO3\CMS\Backend\View\BackendLayout\BackendLayout::class)
81 ->setMethods([
'getIdentifier'])
82 ->disableOriginalConstructor()
84 $secondBackendLayoutMock->expects($this->once())->method(
'getIdentifier')->will($this->returnValue($backendLayoutIdentifier));
86 $backendLayoutCollection->add($firstBackendLayoutMock);
87 $backendLayoutCollection->add($secondBackendLayoutMock);
95 $identifier = $this->getUniqueId(
'identifier');
96 $backendLayoutCollection = new \TYPO3\CMS\Backend\View\BackendLayout\BackendLayoutCollection($identifier);
97 $backendLayoutIdentifier = $this->getUniqueId(
'identifier');
98 $backendLayoutMock = $this->getMockBuilder(\
TYPO3\CMS\Backend\View\BackendLayout\BackendLayout::class)
99 ->setMethods([
'getIdentifier'])
100 ->disableOriginalConstructor()
102 $backendLayoutMock->expects($this->once())->method(
'getIdentifier')->will($this->returnValue($backendLayoutIdentifier));
104 $backendLayoutCollection->add($backendLayoutMock);
106 $this->assertEquals($backendLayoutMock, $backendLayoutCollection->get($backendLayoutIdentifier));