-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor #315 Shop billing data as resource (SirDomin)
This PR was merged into the 1.0-dev branch. Discussion ---------- Commits ------- 9e16c9f add factory and refactor shop billing data 8a7b9a3 Bring back previous methods to avoid bc break b3ff3ba finalize Factory d1a6869 pr-fix b0247e7 coding-standard 90e2732 rebase 1d4e338 add-previous-changes 71f26d2 revert to decorating factory
- Loading branch information
Showing
13 changed files
with
322 additions
and
45 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<?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\RefundPlugin\Factory; | ||
|
||
use PhpSpec\ObjectBehavior; | ||
use Sylius\Component\Resource\Factory\FactoryInterface; | ||
use Sylius\RefundPlugin\Entity\ShopBillingDataInterface; | ||
use Sylius\RefundPlugin\Factory\ShopBillingDataFactoryInterface; | ||
|
||
final class ShopBillingDataFactorySpec extends ObjectBehavior | ||
{ | ||
public function let(FactoryInterface $shopBillingDataFactory): void | ||
{ | ||
$this->beConstructedWith($shopBillingDataFactory); | ||
} | ||
|
||
public function it_implements_shop_billing_data_factory_interface(): void | ||
{ | ||
$this->shouldImplement(ShopBillingDataFactoryInterface::class); | ||
} | ||
|
||
public function it_creates_new_shop_billing_data( | ||
FactoryInterface $shopBillingDataFactory, | ||
ShopBillingDataInterface $shopBillingData | ||
): void { | ||
$shopBillingDataFactory->createNew()->willReturn($shopBillingData); | ||
|
||
$this->createNew()->shouldReturn($shopBillingData); | ||
} | ||
|
||
public function it_creates_new_shop_billing_data_with_data( | ||
ShopBillingDataInterface $shopBillingData, | ||
FactoryInterface $shopBillingDataFactory | ||
): void { | ||
$shopBillingDataFactory->createNew()->willReturn($shopBillingData); | ||
|
||
$shopBillingData->setCompany('Needful Things'); | ||
$shopBillingData->setTaxId('000222'); | ||
$shopBillingData->setCountryCode('US'); | ||
$shopBillingData->setStreet('Main St. 123'); | ||
$shopBillingData->setCity('Los Angeles'); | ||
$shopBillingData->setPostcode('90001'); | ||
|
||
$this | ||
->createWithData('Needful Things', '000222', 'US', 'Main St. 123', 'Los Angeles', '90001') | ||
->shouldBeLike($shopBillingData) | ||
; | ||
} | ||
} |
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
Oops, something went wrong.