Пример #1
0
 /**
  * @test
  * @return void
  */
 public function limitCanBeSet()
 {
     $value = 10;
     $this->instance->setLimit($value);
     $this->assertEquals($value, $this->instance->getLimit());
 }
 /**
  * If no limit is set in the settings we fallback to the defaultLimit
  * setting and if this is empty for the current action we use the
  * default limit defined in the DEFAULT_LIMIT constant.
  *
  * @param \GeorgRinger\News\Domain\Model\Dto\NewsDemand $demand
  */
 protected function initializeDefaultLimitForCurrentActionIfNotSet($demand)
 {
     if ($this->settings['limit'] !== '') {
         return;
     }
     $controllerActionName = $this->request->getControllerActionName();
     if (isset($this->settings['defaultLimit'][$controllerActionName])) {
         $demand->setLimit($this->settings['defaultLimit'][$controllerActionName]);
     } else {
         $demand->setLimit(static::DEFAULT_LIMIT);
     }
 }