Пример #1
0
 /**
  * @param string $url
  * @return Language
  */
 private function getLanguage($url)
 {
     if (isset($this->languages[$url])) {
         return $this->languages;
     }
     $query = $this->queryFactory->create();
     $language = $query->getByUrl($url)->one();
     if ($language === null) {
         $language = $query->getDefault()->one();
         $url = self::DEFAULT_KEY;
     }
     $this->languages[$url] = $language;
     return $this->languages[$url];
 }
Пример #2
0
 /**
  * @inheritdoc
  */
 protected function _before()
 {
     $this->queryFactory = $this->getMockBuilder(LanguageQueryFactory::class)->disableOriginalConstructor()->getMock();
     $this->queryMock = $this->getMockBuilder(LanguageQuery::class)->setMethods(['getByUrl', 'one', 'getDefault'])->disableOriginalConstructor()->getMock();
     $this->queryFactory->expects(self::any())->method('create')->willReturn($this->queryMock);
 }