public function testCommitResultForSuccessFail() { // build is a fail $process = $this->getProcess(); $process->expects($this->once())->method('isSuccessful')->will($this->returnValue(false)); $process->expects($this->once())->method('getOutput')->will($this->returnValue('foo')); $process->expects($this->once())->method('getErrorOutput')->will($this->returnValue('bar')); // build is triggered as commit does not exist $builder = $this->getBuilder(); $builder->expects($this->once())->method('prepare')->will($this->returnValue(array('sha1', 'fabien', '2011-01-01 01:01:01 +0200', 'initial commit'))); $builder->expects($this->once())->method('build')->will($this->returnValue($process)); // check commit status $commit = $this->getCommit(); $commit->expects($this->once())->method('setStatusCode')->with($this->equalTo('failed')); $commit->expects($this->once())->method('setOutput')->with($this->matchesRegularExpression('/foo.*bar/s')); // check that storage is updated $storage = $this->getStorage(); $storage->expects($this->any())->method('initCommit')->will($this->returnValue($commit)); $storage->expects($this->once())->method('updateCommit')->with($this->equalTo($commit)); $sismo = new Sismo($storage, $builder); $sismo->build($this->getProject()); }