private function createTaskWithMockedRepo($comment) { $repoMock = $this->getMockBuilder('Stark\\core\\Repository')->getMock(); $repoMock->expects($this->once())->method('getComment')->will($this->returnValue($comment)); $container = new \Stark\core\Container(); $container->setRepo($repoMock); $task = new \Stark\tasks\Trac\TicketExists(); $task->setContainer($container); return $task; }
public function testinitializeDefault() { $time = time(); $properties = new Properties(); $container = new \Stark\core\Container(); $container['timestamp'] = $time; $repoMock = $this->getMock('Stark\\core\\Repository', array('getFileContent', 'getComment', 'getAuthor', 'getChangedFilesCollection')); $repoMock->expects($this->once())->method('getComment')->will($this->returnValue('message')); $repoMock->expects($this->once())->method('getAuthor')->will($this->returnValue('author')); $container->setRepo($repoMock); $properties->setContainer($container); $properties->initializeDefault(); $this->assertEquals($properties->get('timestamp'), $time); $this->assertEquals($properties->get('author'), 'author'); $this->assertEquals($properties->get('message'), 'message'); $this->assertEquals($properties->get('author'), 'author'); $this->assertEquals($properties->get('message'), 'message'); }