-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
41 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace spec\Sylius\ShopApiPlugin\ViewRepository\Cart; | ||
|
||
use PhpSpec\ObjectBehavior; | ||
use Sylius\Component\Core\Model\OrderInterface; | ||
use Sylius\Component\Core\Repository\OrderRepositoryInterface; | ||
use Sylius\ShopApiPlugin\Factory\Cart\CartViewFactoryInterface; | ||
use Sylius\ShopApiPlugin\View\Cart\CartSummaryView; | ||
use Sylius\ShopApiPlugin\ViewRepository\Cart\CartViewRepositoryInterface; | ||
|
||
final class CartViewRepositorySpec extends ObjectBehavior | ||
{ | ||
function let(OrderRepositoryInterface $cartRepository, CartViewFactoryInterface $cartViewFactory): void | ||
{ | ||
$this->beConstructedWith($cartRepository, $cartViewFactory); | ||
} | ||
|
||
function it_is_cart_query(): void | ||
{ | ||
$this->shouldImplement(CartViewRepositoryInterface::class); | ||
} | ||
|
||
function it_provides_cart_view( | ||
OrderRepositoryInterface $cartRepository, | ||
CartViewFactoryInterface $cartViewFactory, | ||
OrderInterface $cart, | ||
CartSummaryView $cartView | ||
): void { | ||
$cartRepository->findOneBy(['tokenValue' => 'ORDERTOKEN', 'state' => 'cart'])->willReturn($cart); | ||
$cart->getLocaleCode()->willReturn('en_GB'); | ||
|
||
$cartViewFactory->create($cart, 'en_GB')->willReturn($cartView); | ||
|
||
$this->getOneByToken('ORDERTOKEN')->shouldReturn($cartView); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters