public function testDefaultIfNotFound()
 {
     $accountUser = new AccountUser();
     $accountUser->setAccount($this->getAccount('account.level_1'));
     $this->websiteManager->expects($this->once())->method('getCurrentWebsite')->willReturn(null);
     $this->assertTrue($this->handler->getPriceList($accountUser)->isDefault());
 }
 public function testGetCurrentWebsite()
 {
     $repository = $this->getMockBuilder('Doctrine\\ORM\\EntityRepository')->disableOriginalConstructor()->getMock();
     $repository->expects($this->once())->method('findOneBy')->with($this->isType('array'), $this->isType('array'))->willReturn(new Website());
     $objectManager = $this->getMock('Doctrine\\Common\\Persistence\\ObjectManager');
     $objectManager->expects($this->once())->method('getRepository')->with('OroB2BWebsiteBundle:Website')->willReturn($repository);
     $this->managerRegistry->expects($this->once())->method('getManagerForClass')->with('OroB2BWebsiteBundle:Website')->willReturn($objectManager);
     $this->assertEquals(new Website(), $this->manager->getCurrentWebsite());
 }
 /**
  * @return null|PriceList
  */
 protected function getPriceListFromWebsite()
 {
     $website = $this->websiteManager->getCurrentWebsite();
     if (!$website) {
         return null;
     }
     $priceList = $this->getPriceListRepository()->getPriceListByWebsite($website);
     if ($priceList) {
         return $priceList;
     }
     return null;
 }