public function testSaveNoExistingCustomer()
{
$basket = $this->getMock('Sonata\\Component\\Basket\\BasketInterface');
$basket->expects($this->once())->method('getCustomerId')->will($this->returnValue(false));
$basketManager = $this->getMock('Sonata\\Component\\Basket\\BasketManagerInterface');
$basketBuilder = $this->getMock('Sonata\\Component\\Basket\\BasketBuilderInterface');
$session = $this->getMock('Symfony\\Component\\HttpFoundation\\Session\\SessionInterface');
$tester = $this;
$session->expects($this->once())->method('set')->will($this->returnCallback(function ($key, $value) use($tester, $basket) {
$tester->assertEquals($basket, $value);
$tester->assertEquals('sonata/basket/factory/customer/new', $key);
}));
$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 BasketEntityFactory($basketManager, $basketBuilder, $currencyDetector, $session);
$factory->save($basket);
}