예제 #1
0
 public function testNotify()
 {
     $project = new Project('Twig');
     $failedCommit = new Commit($project, '123456');
     $failedCommit->setAuthor('Fabien');
     $failedCommit->setMessage('Foo');
     $successCommit = new Commit($project, '123455');
     $successCommit->setAuthor('Fabien');
     $successCommit->setMessage('Bar');
     $successCommit->setStatusCode('success');
     $baseNotifier = $this->getMock('Sismo\\Notifier\\Notifier');
     $baseNotifier->expects($this->once())->method('notify')->will($this->returnValue('foo'));
     $notifier = new CrossFingerNotifier(array($baseNotifier));
     //a failed commit should call notify on real notifier
     $this->assertTrue($notifier->notify($failedCommit));
     $project->setCommits(array($successCommit));
     //a success commit should not call notify on real notifier
     $this->assertFalse($notifier->notify($successCommit));
 }
예제 #2
0
 public function testNotify()
 {
     $project = new Project('Twig');
     $successCommit = new Commit($project, '123455');
     $successCommit->setAuthor('Fabien');
     $successCommit->setMessage('Bar');
     $successCommit->setStatusCode('success');
     $failedCommit = new Commit($project, '123456');
     $failedCommit->setAuthor('Fabien');
     $failedCommit->setMessage('Foo');
     $failedCommit->setStatusCode('failed');
     $project->setCommits(array($failedCommit, $successCommit));
     $logger = $this->getMock('Psr\\Log\\NullLogger');
     $logger->expects($this->once())->method('info');
     $logger->expects($this->once())->method('critical');
     $notifier = new LoggerNotifier($logger);
     //notify success commit
     $notifier->notify($successCommit);
     //notify failed commit
     $notifier->notify($failedCommit);
 }
예제 #3
0
 public function testCCActivity()
 {
     $project = new Project('Twig Local');
     $this->assertEquals('Sleeping', $project->getCCActivity());
     $commit = $this->getMockBuilder('Sismo\\Commit')->disableOriginalConstructor()->getMock();
     $commit->expects($this->once())->method('isBuilding')->will($this->returnValue(true));
     $project->setCommits(array($commit));
     $this->assertEquals('Building', $project->getCCActivity());
     $commit = $this->getMockBuilder('Sismo\\Commit')->disableOriginalConstructor()->getMock();
     $commit->expects($this->once())->method('isBuilding')->will($this->returnValue(false));
     $project->setCommits(array($commit));
     $this->assertEquals('Sleeping', $project->getCCActivity());
 }