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;
 }
Example #2
0
 /**
  * @expectedException \InvalidArgumentException
  */
 public function testOmmitingNameFails()
 {
     $container = new \Stark\core\Container();
     $propertiesMock = $this->getMock('\\Stark\\core\\Properties', array('set'));
     $propertiesMock->expects($this->never())->method('set');
     $container->setProperties($propertiesMock);
     $this->propertyTask->setContainer($container);
     $this->propertyTask->setValue('test');
     $this->propertyTask->execute();
 }
Example #3
0
 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');
 }