Пример #1
0
 /**
  * @link https://github.com/doctrine/doctrine1/blob/master/lib/Doctrine/Pager/Layout.php#L406
  * @param  array  $options
  * @return string
  */
 protected function parseUrlTemplate(array $options = [])
 {
     $str = '';
     // If given page is the current active one
     if ($options['page_number'] == $this->pager->getCurrentPage()) {
         $str = $this->parseMaskReplacements($this->selectedTemplate);
     }
     // Possible attempt where Selected == Template
     if ($str == '') {
         $str = $this->parseMaskReplacements($this->template);
     }
     return $str;
 }
Пример #2
0
 /**
  * @expectedException \RuntimeException
  * @expectedExceptionMessage Unable to find layout "UnknownLayoutClass"
  */
 public function testGetLayoutMethodShouldWithInvalidLayoutClassShouldThrowException()
 {
     // stub paginate
     $paginate = new stdClass();
     $paginate->total_pages = 20;
     $paginate->current = 1;
     $mock = Mockery::mock(self::BUILDER_CLASS);
     $mock->shouldReceive('getPaginate')->once()->andReturn($paginate);
     $mock->shouldReceive('getLimit')->once()->andReturn(null);
     $pager = new Pager($mock, ['rangeLength' => 5, 'layoutClass' => 'UnknownLayoutClass', 'urlMask' => 'xxx']);
     $pager->getLayout();
 }