public function testLoadWithBasket()
{
$basket = $this->getMock('Sonata\\Component\\Basket\\BasketInterface');
$basket->expects($this->once())->method('setCustomer');
$basketManager = $this->getMock('Sonata\\Component\\Basket\\BasketManagerInterface');
$basketBuilder = $this->getMock('Sonata\\Component\\Basket\\BasketBuilderInterface');
$basketBuilder->expects($this->once())->method('build');
$customer = $this->getMock('Sonata\\Component\\Customer\\CustomerInterface');
$customer->expects($this->any())->method('getId')->will($this->returnValue(1));
$session = new Session(new MockArraySessionStorage());
$session->set('sonata/basket/factory/customer/1', $basket);
$currencyDetector = $this->getMock('Sonata\\Component\\Currency\\CurrencyDetectorInterface');
$currency = new Currency();
$currency->setLabel('EUR');
$currencyDetector->expects($this->any())->method('getCurrency')->will($this->returnValue($currency));
$factory = new BasketSessionFactory($basketManager, $basketBuilder, $currencyDetector, $session);
$basket = $factory->load($customer);
$this->isInstanceOf('Sonata\\Component\\Basket\\BasketInterface', $basket);
}