[CLEANUP] Remove deprecated repository constructor
[Packages/TYPO3.CMS.git] / typo3 / sysext / extensionmanager / Tests / Unit / Domain / Repository / RepositoryRepositoryTest.php
1 <?php
2 namespace TYPO3\CMS\Extensionmanager\Tests\Unit\Domain\Repository;
3
4 /***************************************************************
5 * Copyright notice
6 *
7 * (c) 2012-2013 Christian Kuhn, <lolli@schwarzbu.ch>
8 * All rights reserved
9 *
10 * This script is part of the TYPO3 project. The TYPO3 project is
11 * free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * The GNU General Public License can be found at
17 * http://www.gnu.org/copyleft/gpl.html.
18 *
19 * This script is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * This copyright notice MUST APPEAR in all copies of the script!
25 ***************************************************************/
26
27 /**
28 * Test case
29 *
30 * @author Christian Kuhn <lolli@schwarzbu.ch>
31 */
32 class RepositoryRepositoryTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
33
34 /**
35 * @var \TYPO3\CMS\Extbase\Object\ObjectManagerInterface
36 */
37 protected $mockObjectManager;
38
39 /**
40 * @var \TYPO3\CMS\Extensionmanager\Domain\Repository\RepositoryRepository
41 */
42 protected $fixture;
43
44 public function setUp() {
45 $this->mockObjectManager = $this->getMock('TYPO3\\CMS\\Extbase\\Object\\ObjectManagerInterface');
46 /** @var $fixture \TYPO3\CMS\Extensionmanager\Domain\Repository\RepositoryRepository|\PHPUnit_Framework_MockObject_MockObject */
47 $this->fixture = $this->getMock('TYPO3\\CMS\\Extensionmanager\\Domain\\Repository\\RepositoryRepository', array('findAll'), array($this->mockObjectManager));
48 }
49
50 /**
51 * @test
52 */
53 public function findOneTypo3OrgRepositoryReturnsNullIfNoRepositoryWithThisTitleExists() {
54
55 $this->fixture
56 ->expects($this->once())
57 ->method('findAll')
58 ->will($this->returnValue(array()));
59
60 $this->assertNull($this->fixture->findOneTypo3OrgRepository());
61 }
62
63 /**
64 * @test
65 */
66 public function findOneTypo3OrgRepositoryReturnsRepositoryWithCorrectTitle() {
67 $mockModelOne = $this->getMock('TYPO3\\CMS\\Extensionmanager\\Domain\\Model\\Repository');
68 $mockModelOne
69 ->expects(($this->once()))
70 ->method('getTitle')
71 ->will($this->returnValue('foo'));
72 $mockModelTwo = $this->getMock('TYPO3\\CMS\\Extensionmanager\\Domain\\Model\\Repository');
73 $mockModelTwo
74 ->expects(($this->once()))
75 ->method('getTitle')
76 ->will($this->returnValue('TYPO3.org Main Repository'));
77
78 $this->fixture
79 ->expects($this->once())
80 ->method('findAll')
81 ->will($this->returnValue(array($mockModelOne, $mockModelTwo)));
82
83 $this->assertSame($mockModelTwo, $this->fixture->findOneTypo3OrgRepository());
84 }
85 }
86
87
88 ?>