TYPO3 CMS  TYPO3_6-2
RepositoryRepositoryTest.php
Go to the documentation of this file.
1 <?php
3 
22 
26  protected $mockObjectManager;
27 
31  protected $fixture;
32 
33  public function setUp() {
34  $this->mockObjectManager = $this->getMock('TYPO3\\CMS\\Extbase\\Object\\ObjectManagerInterface');
36  $this->fixture = $this->getMock('TYPO3\\CMS\\Extensionmanager\\Domain\\Repository\\RepositoryRepository', array('findAll'), array($this->mockObjectManager));
37  }
38 
43 
44  $this->fixture
45  ->expects($this->once())
46  ->method('findAll')
47  ->will($this->returnValue(array()));
48 
49  $this->assertNull($this->fixture->findOneTypo3OrgRepository());
50  }
51 
56  $mockModelOne = $this->getMock('TYPO3\\CMS\\Extensionmanager\\Domain\\Model\\Repository');
57  $mockModelOne
58  ->expects(($this->once()))
59  ->method('getTitle')
60  ->will($this->returnValue('foo'));
61  $mockModelTwo = $this->getMock('TYPO3\\CMS\\Extensionmanager\\Domain\\Model\\Repository');
62  $mockModelTwo
63  ->expects(($this->once()))
64  ->method('getTitle')
65  ->will($this->returnValue('TYPO3.org Main Repository'));
66 
67  $this->fixture
68  ->expects($this->once())
69  ->method('findAll')
70  ->will($this->returnValue(array($mockModelOne, $mockModelTwo)));
71 
72  $this->assertSame($mockModelTwo, $this->fixture->findOneTypo3OrgRepository());
73  }
74 }