Skip to content

Commit

Permalink
Full coverage after refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
mariusjp committed Apr 6, 2022
1 parent 390d3ee commit b2de9ae
Showing 1 changed file with 40 additions and 6 deletions.
46 changes: 40 additions & 6 deletions src/Test/Unit/Service/CustomerQuoteTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,15 +103,32 @@ public function testGetQuoteGuestWithExistingCart(): void
->method('isLoggedIn')
->willReturn(false);

$quoteMock = $this->createQuote();
$quoteMock
$quoteMockNotFullyLoaded = $this->createQuote();
$quoteMockNotFullyLoaded
->expects(self::exactly(2))
->method('getId')
->willReturn(1);
->willReturn(null, 456);

$this->checkoutSession
->expects(self::once())
->method('getQuote')
->willReturn($quoteMockNotFullyLoaded);

$this->quoteRepository
->expects(self::once())
->method('save')
->with($quoteMockNotFullyLoaded);

$quoteMock = $this->createQuote();
$quoteMock
->expects(self::once())
->method('getId')
->willReturn(456);

$this->quoteRepository
->expects(self::once())
->method('get')
->with(456)
->willReturn($quoteMock);

$quote = $customerQuote->getQuote();
Expand Down Expand Up @@ -177,15 +194,32 @@ public function testGetQuoteCustomerWithExistingCart(): void
->method('isLoggedIn')
->willReturn(true);

$quoteMock = $this->createQuote();
$quoteMock
$quoteMockNotFullyLoaded = $this->createQuote();
$quoteMockNotFullyLoaded
->expects(self::exactly(2))
->method('getId')
->willReturn(1);
->willReturn(null, 456);

$this->checkoutSession
->expects(self::once())
->method('getQuote')
->willReturn($quoteMockNotFullyLoaded);

$this->quoteRepository
->expects(self::once())
->method('save')
->with($quoteMockNotFullyLoaded);

$quoteMock = $this->createQuote();
$quoteMock
->expects(self::once())
->method('getId')
->willReturn(456);

$this->quoteRepository
->expects(self::once())
->method('get')
->with(456)
->willReturn($quoteMock);

$quote = $customerQuote->getQuote();
Expand Down

0 comments on commit b2de9ae

Please sign in to comment.