-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
9 changed files
with
69 additions
and
36 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
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
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
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
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
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
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
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
49 changes: 49 additions & 0 deletions
49
...us/Bundle/ApiBundle/spec/Applicator/ProductReviewStateMachineTransitionApplicatorSpec.php
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,49 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Sylius package. | ||
* | ||
* (c) Paweł Jędrzejewski | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace spec\Sylius\Bundle\ApiBundle\Applicator; | ||
|
||
use PhpSpec\ObjectBehavior; | ||
use SM\Factory\FactoryInterface as StateMachineFactoryInterface; | ||
use SM\StateMachine\StateMachine; | ||
use Sylius\Component\Core\ProductReviewTransitions; | ||
use Sylius\Component\Review\Model\ReviewInterface; | ||
|
||
final class ProductReviewStateMachineTransitionApplicatorSpec extends ObjectBehavior | ||
{ | ||
function let(StateMachineFactoryInterface $stateMachineFactory) { | ||
$this->beConstructedWith($stateMachineFactory); | ||
} | ||
|
||
public function it_accepts_product_review( | ||
StateMachineFactoryInterface $stateMachineFactory, | ||
ReviewInterface $review, | ||
StateMachine $stateMachine | ||
): void { | ||
$stateMachineFactory->get($review, ProductReviewTransitions::GRAPH)->willReturn($stateMachine); | ||
$stateMachine->apply(ProductReviewTransitions::TRANSITION_ACCEPT)->shouldBeCalled(); | ||
|
||
$this->accept($review); | ||
} | ||
|
||
public function it_rejects_product_review( | ||
StateMachineFactoryInterface $stateMachineFactory, | ||
ReviewInterface $review, | ||
StateMachine $stateMachine | ||
): void { | ||
$stateMachineFactory->get($review, ProductReviewTransitions::GRAPH)->willReturn($stateMachine); | ||
$stateMachine->apply(ProductReviewTransitions::TRANSITION_REJECT)->shouldBeCalled(); | ||
|
||
$this->reject($review); | ||
} | ||
} |