Esempio n. 1
0
 public function testExecuteWithWishlist()
 {
     $wishlist = $this->getMockBuilder('Magento\\Wishlist\\Model\\Wishlist')->disableOriginalConstructor()->getMock();
     $this->wishlistProvider->expects($this->once())->method('getWishlist')->willReturn($wishlist);
     $this->request->expects($this->once())->method('getParam')->with('qty')->will($this->returnValue(2));
     $this->itemCarrier->expects($this->once())->method('moveAllToCart')->with($wishlist, 2)->will($this->returnValue('http://redirect-url.com'));
     $this->response->expects($this->once())->method('setRedirect')->will($this->returnValue('http://redirect-url.com'));
     $controller = $this->getController();
     $controller->execute();
 }
Esempio n. 2
0
    public function testExecuteWithNoWishlist()
    {
        $this->wishlistProviderMock->expects($this->once())
            ->method('getWishlist')
            ->willReturn(false);
        $this->resultForwardMock->expects($this->once())
            ->method('forward')
            ->with('noroute')
            ->willReturnSelf();

        $this->assertSame($this->resultForwardMock, $this->allcartController->executeInternal());
    }