TYPO3  7.6
DocumentTest.php
Go to the documentation of this file.
1 <?php
2 namespace TYPO3\CMS\Documentation\Tests\Unit\Domain\Model;
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 
20 class DocumentTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
21 {
25  protected $subject;
26 
27  protected function setUp()
28  {
29  $this->subject = new \TYPO3\CMS\Documentation\Domain\Model\Document();
30  }
31 
36  {
37  $this->subject->setPackageKey('Conceived at T3DD13');
38 
39  $this->assertSame(
40  'Conceived at T3DD13',
41  $this->subject->getPackageKey()
42  );
43  }
44 
48  public function setIconForStringSetsTitle()
49  {
50  $this->subject->setIcon('Conceived at T3DD13');
51 
52  $this->assertSame(
53  'Conceived at T3DD13',
54  $this->subject->getIcon()
55  );
56  }
57 
62  {
63  $newObjectStorage = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
64  $this->assertEquals(
65  $newObjectStorage,
66  $this->subject->getTranslations()
67  );
68  }
69 
74  {
75  $translation = new \TYPO3\CMS\Documentation\Domain\Model\DocumentTranslation();
76  $objectStorageHoldingExactlyOneTranslations = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
77  $objectStorageHoldingExactlyOneTranslations->attach($translation);
78  $this->subject->setTranslations($objectStorageHoldingExactlyOneTranslations);
79 
80  $this->assertSame(
81  $objectStorageHoldingExactlyOneTranslations,
82  $this->subject->getTranslations()
83  );
84  }
85 
90  {
91  $translation = new \TYPO3\CMS\Documentation\Domain\Model\DocumentTranslation();
92  $objectStorageHoldingExactlyOneTranslation = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
93  $objectStorageHoldingExactlyOneTranslation->attach($translation);
94  $this->subject->addTranslation($translation);
95 
96  $this->assertEquals(
97  $objectStorageHoldingExactlyOneTranslation,
98  $this->subject->getTranslations()
99  );
100  }
101 
106  {
107  $translation = new \TYPO3\CMS\Documentation\Domain\Model\DocumentTranslation();
108  $localObjectStorage = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
109  $localObjectStorage->attach($translation);
110  $localObjectStorage->detach($translation);
111  $this->subject->addTranslation($translation);
112  $this->subject->removeTranslation($translation);
113 
114  $this->assertEquals(
115  $localObjectStorage,
116  $this->subject->getTranslations()
117  );
118  }
119 }