Skip to content

Commit

Permalink
Review fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Arminek committed Jun 24, 2016
1 parent 97296d8 commit 9fa95f8
Show file tree
Hide file tree
Showing 10 changed files with 26 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Feature: Adding a note to order
And the store has a product "PHP T-Shirt" priced at "$19.99"
And the store ships everywhere for free
And the store allows paying offline
And the store has customer service account identified by "sylius@example.com"
And there is an administrator identified by "sylius@example.com"
And there is a customer account "customer@example.com" identified by "sylius"
And I am logged in as "customer@example.com"

Expand Down
2 changes: 1 addition & 1 deletion src/Sylius/Behat/Context/Setup/UserContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public function hisAccountWasDeleted()
}

/**
* @Given the store has customer service account identified by :email
* @Given there is an administrator identified by :email
*/
public function theStoreHasCustomerServiceAccountIdentifiedBy($email)
{
Expand Down
1 change: 0 additions & 1 deletion src/Sylius/Behat/Context/Transform/CustomerContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ public function __construct(CustomerRepositoryInterface $customerRepository, Fac

/**
* @Transform :customer
* @Transform /^made by "[^"]+"$/
*/
public function getOrCreateCustomerByEmail($email)
{
Expand Down
14 changes: 6 additions & 8 deletions src/Sylius/Behat/Page/Admin/Order/ShowPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
use Sylius\Behat\Service\Accessor\TableAccessorInterface;
use Sylius\Component\Core\Model\OrderInterface;
use Symfony\Component\Routing\RouterInterface;
use Webmozart\Assert\Assert;

/**
* @author Łukasz Chruściel <lukasz.chrusciel@lakion.com>
Expand Down Expand Up @@ -333,20 +332,19 @@ public function deleteOrder()
/**
* {@inheritdoc}
*/
public function getRouteName()
public function hasNote($note)
{
return 'sylius_admin_order_show';
$orderNotesElement = $this->getElement('order_notes');

return $orderNotesElement->getText() === $note;
}

/**
* {@inheritdoc}
*/
public function hasNote($note)
public function getRouteName()
{
$orderNotesElement = $this->getElement('order_notes');
Assert::notNull($orderNotesElement, 'Cannot find order notes');

return $orderNotesElement->getText() === $note;
return 'sylius_admin_order_show';
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% if order.notes is defined and order.notes is not null %}
{% if order.notes is not null %}
<h4 class="ui top attached styled header">
{{ 'sylius.ui.notes'|trans }}
</h4>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
/**
* @author Arkadiusz Krakowiak <arkadiusz.krakowiak@lakion.com>
*/
class SummaryNoteType extends AbstractResourceType
class SummaryType extends AbstractResourceType
{
/**
* {@inheritdoc}
Expand All @@ -35,6 +35,6 @@ public function buildForm(FormBuilderInterface $builder, array $options)
*/
public function getName()
{
return 'sylius_checkout_summary_note';
return 'sylius_checkout_summary';
}
}
6 changes: 3 additions & 3 deletions src/Sylius/Bundle/CoreBundle/Resources/config/form.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<parameter key="sylius.checkout_form.shipping.class">Sylius\Bundle\CoreBundle\Form\Type\Checkout\ShippingStepType</parameter>
<parameter key="sylius.checkout_form.shop_addressing.class">Sylius\Bundle\CoreBundle\Form\Type\Checkout\AddressingType</parameter>
<parameter key="sylius.checkout_form.shop_shipping.class">Sylius\Bundle\CoreBundle\Form\Type\Checkout\ShippingType</parameter>
<parameter key="sylius.checkout_form.summary_note.class">Sylius\Bundle\CoreBundle\Form\Type\Checkout\SummaryNoteType</parameter>
<parameter key="sylius.checkout_form.summary.class">Sylius\Bundle\CoreBundle\Form\Type\Checkout\SummaryType</parameter>

<parameter key="sylius.form.type.image.class">Sylius\Bundle\CoreBundle\Form\Type\ImageType</parameter>
<parameter key="sylius.form.type.list.class">Sylius\Bundle\CoreBundle\Form\Type\ListType</parameter>
Expand Down Expand Up @@ -94,9 +94,9 @@
</argument>
<tag name="form.type" alias="sylius_checkout_payment_step" />
</service>
<service id="sylius_checkout_form.summary_note" class="%sylius.checkout_form.summary_note.class%">
<service id="sylius_checkout_form.summary" class="%sylius.checkout_form.summary.class%">
<argument>%sylius.model.cart.class%</argument>
<tag name="form.type" alias="sylius_checkout_summary_note" />
<tag name="form.type" alias="sylius_checkout_summary" />
</service>

<service id="sylius.form.type.cart" class="%sylius.form.type.cart.class%">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@

use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
use Sylius\Bundle\CoreBundle\Form\Type\Checkout\SummaryNoteType;
use Sylius\Bundle\CoreBundle\Form\Type\Checkout\SummaryType;
use Sylius\Bundle\ResourceBundle\Form\Type\AbstractResourceType;
use Symfony\Component\Form\FormBuilderInterface;

/**
* @mixin SummaryNoteType
* @mixin SummaryType
*
* @author Arkadiusz Krakowiak <arkadiusz.krakowiak@lakion.com>
*/
class SummaryNoteTypeSpec extends ObjectBehavior
class SummaryTypeSpec extends ObjectBehavior
{
function let()
{
Expand All @@ -31,7 +31,7 @@ function let()

function it_is_initializable()
{
$this->shouldHaveType('Sylius\Bundle\CoreBundle\Form\Type\Checkout\SummaryNoteType');
$this->shouldHaveType('Sylius\Bundle\CoreBundle\Form\Type\Checkout\SummaryType');
}

function it_is_a_resource_form_type()
Expand All @@ -48,6 +48,6 @@ function it_builds_form(FormBuilderInterface $builder)

function it_has_name()
{
$this->getName()->shouldReturn('sylius_checkout_summary_note');
$this->getName()->shouldReturn('sylius_checkout_summary');
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,4 @@ sylius_shop_checkout_summary:
transition: create
redirect: sylius_shop_homepage
form:
type: sylius_checkout_summary_note
type: sylius_checkout_summary
6 changes: 6 additions & 0 deletions src/Sylius/Component/Order/spec/Model/OrderSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -486,4 +486,10 @@ function it_should_be_able_to_clear_items(OrderItemInterface $item)
$this->clearItems();
$this->shouldBeEmpty();
}

function it_has_notes()
{
$this->setNotes('something squishy');
$this->getNotes()->shouldReturn('something squishy');
}
}

0 comments on commit 9fa95f8

Please sign in to comment.