TYPO3 CMS  TYPO3_7-6
BackendLayoutCollectionTest.php
Go to the documentation of this file.
1 <?php
3 
4 /*
5  * This file is part of the TYPO3 CMS project.
6  *
7  * It is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU General Public License, either version 2
9  * of the License, or any later version.
10  *
11  * For the full copyright and license information, please read the
12  * LICENSE.txt file that was distributed with this source code.
13  *
14  * The TYPO3 project - inspiring people to share!
15  */
16 
21 {
27  {
28  $identifier = $this->getUniqueId('identifier__');
29  new \TYPO3\CMS\Backend\View\BackendLayout\BackendLayoutCollection($identifier);
30  }
31 
35  public function objectIsCreated()
36  {
37  $identifier = $this->getUniqueId('identifier');
38  $backendLayoutCollection = new \TYPO3\CMS\Backend\View\BackendLayout\BackendLayoutCollection($identifier);
39 
40  $this->assertEquals($identifier, $backendLayoutCollection->getIdentifier());
41  }
42 
48  {
49  $identifier = $this->getUniqueId('identifier');
50  $backendLayoutCollection = new \TYPO3\CMS\Backend\View\BackendLayout\BackendLayoutCollection($identifier);
51  $backendLayoutIdentifier = $this->getUniqueId('identifier__');
52  $backendLayoutMock = $this->getMock(\TYPO3\CMS\Backend\View\BackendLayout\BackendLayout::class, ['getIdentifier'], [], '', false);
53  $backendLayoutMock->expects($this->once())->method('getIdentifier')->will($this->returnValue($backendLayoutIdentifier));
54 
55  $backendLayoutCollection->add($backendLayoutMock);
56  }
57 
63  {
64  $identifier = $this->getUniqueId('identifier');
65  $backendLayoutCollection = new \TYPO3\CMS\Backend\View\BackendLayout\BackendLayoutCollection($identifier);
66  $backendLayoutIdentifier = $this->getUniqueId('identifier');
67  $firstBackendLayoutMock = $this->getMock(\TYPO3\CMS\Backend\View\BackendLayout\BackendLayout::class, ['getIdentifier'], [], '', false);
68  $firstBackendLayoutMock->expects($this->once())->method('getIdentifier')->will($this->returnValue($backendLayoutIdentifier));
69  $secondBackendLayoutMock = $this->getMock(\TYPO3\CMS\Backend\View\BackendLayout\BackendLayout::class, ['getIdentifier'], [], '', false);
70  $secondBackendLayoutMock->expects($this->once())->method('getIdentifier')->will($this->returnValue($backendLayoutIdentifier));
71 
72  $backendLayoutCollection->add($firstBackendLayoutMock);
73  $backendLayoutCollection->add($secondBackendLayoutMock);
74  }
75 
79  public function backendLayoutCanBeFetched()
80  {
81  $identifier = $this->getUniqueId('identifier');
82  $backendLayoutCollection = new \TYPO3\CMS\Backend\View\BackendLayout\BackendLayoutCollection($identifier);
83  $backendLayoutIdentifier = $this->getUniqueId('identifier');
84  $backendLayoutMock = $this->getMock(\TYPO3\CMS\Backend\View\BackendLayout\BackendLayout::class, ['getIdentifier'], [], '', false);
85  $backendLayoutMock->expects($this->once())->method('getIdentifier')->will($this->returnValue($backendLayoutIdentifier));
86 
87  $backendLayoutCollection->add($backendLayoutMock);
88 
89  $this->assertEquals($backendLayoutMock, $backendLayoutCollection->get($backendLayoutIdentifier));
90  }
91 }