Автор: Christer Edvartsen (cogo@starzinger.net)
Наследование: extends Formatter, implements Imbo\Http\Response\Formatter\FormatterInterface
Пример #1
0
 /**
  * @dataProvider getStats
  * @covers Imbo\Http\Response\Formatter\Formatter::format
  * @covers Imbo\Http\Response\Formatter\XML::formatStats
  */
 public function testCanFormatAStatsModel($images, $users, $bytes, $customStats, $pattern)
 {
     $model = $this->getMock('Imbo\\Model\\Stats');
     $model->expects($this->once())->method('getNumImages')->will($this->returnValue($images));
     $model->expects($this->once())->method('getNumUsers')->will($this->returnValue($users));
     $model->expects($this->once())->method('getNumBytes')->will($this->returnValue($bytes));
     $model->expects($this->once())->method('getCustomStats')->will($this->returnValue($customStats));
     $this->assertRegExp($pattern, $this->formatter->format($model));
 }
Пример #2
0
 /**
  * @covers Imbo\Http\Response\Formatter\Formatter::format
  * @covers Imbo\Http\Response\Formatter\XML::formatListModel
  */
 public function testCanFormatAnEmptyListModel()
 {
     $list = array();
     $container = 'users';
     $entry = 'user';
     $model = $this->getMock('Imbo\\Model\\ListModel');
     $model->expects($this->once())->method('getList')->will($this->returnValue($list));
     $model->expects($this->once())->method('getContainer')->will($this->returnValue($container));
     $model->expects($this->once())->method('getEntry')->will($this->returnValue($entry));
     $this->assertContains('<imbo><users></users></imbo>', $this->formatter->format($model));
 }