Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add interface prefix to number generator #297

Merged
merged 1 commit into from
May 31, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ always generated after credit memo. Technical changes:
facilitate post-units refunding process.
* Their `__invoke` methods were replaced by `Sylius\RefundPlugin\ProcessManager\UnitsRefundedProcessStepInterface::next(UnitsRefunded $unitsRefunded)`.

1. `Sylius\RefundPlugin\Generator\NumberGenerator` has been changed to `Sylius\RefundPlugin\Generator\NumberGeneratorInterface`.

### UPGRADE FROM 1.0.0-RC.7 TO 1.0.0-RC.8

1. The `fully_refunded` state and the `refund` transition have been removed from `sylius_order` state machine.
Expand Down
6 changes: 3 additions & 3 deletions spec/Factory/CreditMemoFactorySpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@
use Sylius\RefundPlugin\Entity\TaxItemInterface;
use Sylius\RefundPlugin\Factory\CreditMemoFactoryInterface;
use Sylius\RefundPlugin\Generator\CreditMemoIdentifierGeneratorInterface;
use Sylius\RefundPlugin\Generator\NumberGenerator;
use Sylius\RefundPlugin\Generator\NumberGeneratorInterface;
use Sylius\RefundPlugin\Provider\CurrentDateTimeImmutableProviderInterface;

final class CreditMemoFactorySpec extends ObjectBehavior
{
function let(
FactoryInterface $creditMemoFactory,
CreditMemoIdentifierGeneratorInterface $creditMemoIdentifierGenerator,
NumberGenerator $creditMemoNumberGenerator,
NumberGeneratorInterface $creditMemoNumberGenerator,
CurrentDateTimeImmutableProviderInterface $currentDateTimeImmutableProvider
): void {
$this->beConstructedWith(
Expand Down Expand Up @@ -61,7 +61,7 @@ function it_creates_a_new_credit_memo(
function it_creates_a_new_credit_memo_with_data(
FactoryInterface $creditMemoFactory,
CreditMemoIdentifierGeneratorInterface $creditMemoIdentifierGenerator,
NumberGenerator $creditMemoNumberGenerator,
NumberGeneratorInterface $creditMemoNumberGenerator,
CurrentDateTimeImmutableProviderInterface $currentDateTimeImmutableProvider,
CreditMemoInterface $creditMemo,
OrderInterface $order,
Expand Down
2 changes: 1 addition & 1 deletion spec/Generator/CreditMemoGeneratorSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
use Sylius\RefundPlugin\Factory\CreditMemoFactoryInterface;
use Sylius\RefundPlugin\Generator\CreditMemoGeneratorInterface;
use Sylius\RefundPlugin\Generator\CreditMemoIdentifierGeneratorInterface;
use Sylius\RefundPlugin\Generator\NumberGenerator;
use Sylius\RefundPlugin\Generator\NumberGeneratorInterface;
use Sylius\RefundPlugin\Generator\TaxItemsGeneratorInterface;
use Sylius\RefundPlugin\Model\OrderItemUnitRefund;
use Sylius\RefundPlugin\Model\ShipmentRefund;
Expand Down
4 changes: 2 additions & 2 deletions spec/Generator/SequentialNumberGeneratorSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use PhpSpec\ObjectBehavior;
use Sylius\RefundPlugin\Entity\CreditMemoSequenceInterface;
use Sylius\RefundPlugin\Factory\CreditMemoSequenceFactoryInterface;
use Sylius\RefundPlugin\Generator\NumberGenerator;
use Sylius\RefundPlugin\Generator\NumberGeneratorInterface;
use Sylius\RefundPlugin\Provider\CurrentDateTimeImmutableProviderInterface;

final class SequentialNumberGeneratorSpec extends ObjectBehavior
Expand All @@ -33,7 +33,7 @@ function let(

function it_is_number_generator_interface(): void
{
$this->shouldImplement(NumberGenerator::class);
$this->shouldImplement(NumberGeneratorInterface::class);
}

function it_generates_sequential_number(
Expand Down
6 changes: 3 additions & 3 deletions src/Factory/CreditMemoFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
use Sylius\RefundPlugin\Entity\CustomerBillingDataInterface;
use Sylius\RefundPlugin\Entity\ShopBillingDataInterface;
use Sylius\RefundPlugin\Generator\CreditMemoIdentifierGeneratorInterface;
use Sylius\RefundPlugin\Generator\NumberGenerator;
use Sylius\RefundPlugin\Generator\NumberGeneratorInterface;
use Sylius\RefundPlugin\Provider\CurrentDateTimeImmutableProviderInterface;
use Webmozart\Assert\Assert;

Expand All @@ -33,7 +33,7 @@ final class CreditMemoFactory implements CreditMemoFactoryInterface
/** @var CreditMemoIdentifierGeneratorInterface */
private $creditMemoIdentifierGenerator;

/** @var NumberGenerator */
/** @var NumberGeneratorInterface */
private $creditMemoNumberGenerator;

/** @var CurrentDateTimeImmutableProviderInterface */
Expand All @@ -42,7 +42,7 @@ final class CreditMemoFactory implements CreditMemoFactoryInterface
public function __construct(
FactoryInterface $creditMemoFactory,
CreditMemoIdentifierGeneratorInterface $creditMemoIdentifierGenerator,
NumberGenerator $creditMemoNumberGenerator,
NumberGeneratorInterface $creditMemoNumberGenerator,
CurrentDateTimeImmutableProviderInterface $currentDateTimeImmutableProvider
) {
$this->creditMemoFactory = $creditMemoFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Sylius\RefundPlugin\Generator;

interface NumberGenerator
interface NumberGeneratorInterface
{
public function generate(): string;
}
2 changes: 1 addition & 1 deletion src/Generator/SequentialNumberGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
use Sylius\RefundPlugin\Factory\CreditMemoSequenceFactoryInterface;
use Sylius\RefundPlugin\Provider\CurrentDateTimeImmutableProviderInterface;

final class SequentialNumberGenerator implements NumberGenerator
final class SequentialNumberGenerator implements NumberGeneratorInterface
{
/** @var ObjectRepository */
private $sequenceRepository;
Expand Down