<commit_before><?php

/*
 * This file is part of the Sylius package.
 *
 * (c) <NAME>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace spec\Sylius\Bundle\CoreBundle\EventListener;

use PhpSpec\ObjectBehavior;

class OrderCurrencyListenerSpec extends ObjectBehavior
{
    /**
     * @param Sylius\Bundle\MoneyBundle\Context\CurrencyContextInterface $currencyContext
     */
    function let($currencyContext)
    {
        $this->beConstructedWith($currencyContext);
    }

    function it_is_initializable()
    {
        $this->shouldHaveType('Sylius\Bundle\CoreBundle\EventListener\OrderCurrencyListener');
    }

    /**
     * @param Symfony\Component\EventDispatcher\GenericEvent $event
     * @param \stdClass                                      $invalidSubject
     */
    function it_throws_exception_if_event_has_non_order_subject($event, $invalidSubject)
    {
        $event->getSubject()->willReturn($invalidSubject);

        $this
            ->shouldThrow('InvalidArgumentException')
            ->duringProcessOrderCurrency($event)
        ;
    }

    /**
     * @param Symfony\Component\EventDispatcher\GenericEvent $event
     * @param Sylius\Bundle\CoreBundle\Model\OrderInterface  $order
     */
    function it_sets_currency_on_order($currencyContext, $event, $order)
    {
        $event->getSubject()->willReturn($order);
        $currencyContext->getCurrency()->shouldBeCalled()->willReturn('PLN');

        $this->processOrderCurrency($event);
    }
}<commit_msg>Fix the order currency listener spec<commit_after><?php

/*
 * This file is part of the Sylius package.
 *
 * (c) <NAME>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace spec\Sylius\Bundle\CoreBundle\EventListener;

use PhpSpec\ObjectBehavior;

class OrderCurrencyListenerSpec extends ObjectBehavior
{
    /**
     * @param Sylius\Bundle\MoneyBundle\Context\CurrencyContextInterface $currencyContext
     */
    function let($currencyContext)
    {
        $this->beConstructedWith($currencyContext);
    }

    function it_is_initializable()
    {
        $this->shouldHaveType('Sylius\Bundle\CoreBundle\EventListener\OrderCurrencyListener');
    }

    /**
     * @param Sylius\Bundle\CartBundle\Event\CartEvent       $event
     * @param \stdClass                                      $invalidSubject
     */
    function it_throws_exception_if_event_has_non_order_subject($event, $invalidSubject)
    {
        $event->getCart()->willReturn($invalidSubject);

        $this
            ->shouldThrow('InvalidArgumentException')
            ->duringProcessOrderCurrency($event)
        ;
    }

    /**
     * @param Sylius\Bundle\CartBundle\Event\CartEvent       $event
     * @param Sylius\Bundle\CoreBundle\Model\OrderInterface  $order
     */
    function it_sets_currency_on_order($currencyContext, $event, $order)
    {
        $event->getCart()->willReturn($order);
        $currencyContext->getCurrency()->shouldBeCalled()->willReturn('PLN');

        $this->processOrderCurrency($event);
    }
}
{'fraction_non_alphanumeric': 0.11226089683286297, 'fraction_numerical': 0.0, 'mean_word_length': 2.9875, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1571598', 'n_tokens_mistral': 880, 'n_tokens_neox': 874, 'n_words': 151}