Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Allow for using Doctrine ORM >=2.6#9169

Merged
pamil merged 1 commit into
Sylius:1.0from
pamil:1.0-doctrine-2.6
Feb 8, 2018
Merged

Allow for using Doctrine ORM >=2.6#9169
pamil merged 1 commit into
Sylius:1.0from
pamil:1.0-doctrine-2.6

Conversation

@pamil
Copy link
Copy Markdown
Contributor

@pamil pamil commented Feb 8, 2018

No description provided.

@pamil pamil added this to the 1.0 milestone Feb 8, 2018
@pamil pamil self-assigned this Feb 8, 2018
@pamil pamil added Enhancement Minor issues and PRs improving the current solutions (optimizations, typo fixes, etc.). Maintenance CI configurations, READMEs, releases, etc. labels Feb 8, 2018
$productAttribute->getType()->willReturn(SelectAttributeType::TYPE);

$entityManager->getUnitOfWork()->willReturn($unitOfWork);
$unitOfWork->getEntityChangeSet($productAttribute)->willReturn([
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to use Mockery for UnitOfWork mock as Doctrine ORM 2.6 changes getEntityChangeSet definition to return a reference instead of a value and it's no supported by Prophecy.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be honest this spec should be rewritten to follow "don't mock what you don't own" rule and behaviour tested by Behat scenarios, but this one is the quickest solution, allows us to install Doctrine ORM 2.6 and fixes the error seen in #9164.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sad but true

->shouldNotBeCalled()
;
$entityManager->getUnitOfWork()->willReturn($unitOfWork);
$entityManager->getRepository('Sylius\Component\Product\Model\ProductAttributeValue')->shouldNotBeCalled();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any reason for not using ProductAttributeValue::class?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really, just wanted not to change too much as I would rather rewrite the whole test instead :)

$productAttribute->getType()->willReturn(SelectAttributeType::TYPE);

$entityManager->getUnitOfWork()->willReturn($unitOfWork);
$unitOfWork->getEntityChangeSet($productAttribute)->willReturn([
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sad but true

@pamil pamil merged commit 743e796 into Sylius:1.0 Feb 8, 2018
@pamil pamil deleted the 1.0-doctrine-2.6 branch February 8, 2018 14:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Enhancement Minor issues and PRs improving the current solutions (optimizations, typo fixes, etc.). Maintenance CI configurations, READMEs, releases, etc.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants