Skip to content

Commit

Permalink
1.5: Remove deprecated code
Browse files Browse the repository at this point in the history
  • Loading branch information
pierallard committed Feb 22, 2016
1 parent e0e493a commit db9eb9a
Show file tree
Hide file tree
Showing 19 changed files with 52 additions and 894 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@
use Akeneo\Component\Batch\Model\StepExecution;
use Akeneo\Component\FileStorage\Model\FileInfoInterface;
use PhpSpec\ObjectBehavior;
use Pim\Bundle\CatalogBundle\AttributeType\AttributeTypes;
use Pim\Bundle\CatalogBundle\Manager\ChannelManager;
use Pim\Component\Catalog\Model\AttributeInterface;
use Pim\Component\Catalog\Model\ChannelInterface;
use Pim\Component\Catalog\Model\ProductInterface;
use Pim\Component\Catalog\Model\ProductValueInterface;
use Pim\Component\Catalog\Repository\LocaleRepositoryInterface;
use Prophecy\Argument;
use Symfony\Component\Serializer\SerializerInterface;
Expand Down Expand Up @@ -104,8 +107,8 @@ function it_increments_summary_info_including_header(
) {
$products = [$product1, $product2];

$product1->getMedia()->willReturn([]);
$product2->getMedia()->willReturn([]);
$product1->getValues()->willReturn([]);
$product2->getValues()->willReturn([]);

$stepExecution->addSummaryInfo('write', 1)->shouldBeCalled();

Expand All @@ -129,8 +132,8 @@ function it_increments_summary_info_excluding_header(
) {
$products = [$product1, $product2];

$product1->getMedia()->willReturn([]);
$product2->getMedia()->willReturn([]);
$product1->getValues()->willReturn([]);
$product2->getValues()->willReturn([]);

$stepExecution->addSummaryInfo('write', 2)->shouldBeCalled();

Expand All @@ -151,12 +154,29 @@ function it_processes_items_with_media(
ProductInterface $product2,
FileInfoInterface $media1,
FileInfoInterface $media2,
ChannelInterface $channel
ChannelInterface $channel,
ProductValueInterface $value1,
ProductValueInterface $value2,
ProductValueInterface $value3,
AttributeInterface $attribute1,
AttributeInterface $attribute2,
AttributeInterface $attribute3
) {
$products = [$product1, $product2];

$product1->getMedia()->willReturn([$media1]);
$product2->getMedia()->willReturn([$media2]);
$product1->getValues()->willReturn([$value1]);
$product2->getValues()->willReturn([$value2, $value3]);

$value1->getAttribute()->willReturn($attribute1);
$value2->getAttribute()->willReturn($attribute2);
$value3->getAttribute()->willReturn($attribute3);

$attribute1->getAttributeType()->willReturn(AttributeTypes::IMAGE);
$attribute2->getAttributeType()->willReturn(AttributeTypes::FILE);
$attribute3->getAttributeType()->willReturn(AttributeTypes::TEXT);

$value1->getData()->willReturn($media1);
$value2->getData()->willReturn($media2);

$channelManager->getChannelByCode('mobile')->willReturn($channel);
$channel->getLocaleCodes()->willReturn('en-US');
Expand All @@ -179,8 +199,8 @@ function it_processes_items_without_media(
) {
$products = [$product1, $product2];

$product1->getMedia()->willReturn([]);
$product2->getMedia()->willReturn([]);
$product1->getValues()->willReturn([]);
$product2->getValues()->willReturn([]);

$channelManager->getChannelByCode('mobile')->willReturn($channel);
$channel->getLocaleCodes()->willReturn('en-US');
Expand All @@ -200,7 +220,7 @@ function it_processes_items_even_if_it_is_not_an_array(
ProductInterface $product,
ChannelInterface $channel
) {
$product->getMedia()->willReturn([]);
$product->getValues()->willReturn([]);

$channelManager->getChannelByCode('mobile')->willReturn($channel);
$channel->getLocaleCodes()->willReturn('en-US');
Expand Down
34 changes: 0 additions & 34 deletions spec/Pim/Bundle/CatalogBundle/Manager/CategoryManagerSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,43 +25,9 @@ function let(
$objectManager->getRepository(self::CATEGORY_CLASS)->willReturn($categoryRepository);
}

function it_provides_object_manager($objectManager)
{
$this->getObjectManager()->shouldReturn($objectManager);
}

function it_instantiates_a_category()
{
$this->getCategoryInstance()->shouldReturnAnInstanceOf(self::CATEGORY_CLASS);
}

function it_instantiates_a_tree(CategoryInterface $tree)
{
$this->getCategoryInstance()->shouldReturnAnInstanceOf(self::CATEGORY_CLASS);
}

function it_provides_the_category_class_name()
{
$this->getCategoryClass()->shouldReturn(self::CATEGORY_CLASS);
}

function it_provides_the_category_repository($objectManager, $categoryRepository)
{
$objectManager->getRepository(self::CATEGORY_CLASS)->willReturn($categoryRepository);
$this->getEntityRepository()->shouldReturn($categoryRepository);
}

function it_provides_a_category_from_his_code($categoryRepository, CategoryInterface $category)
{
$categoryRepository->findOneBy(['code' => 'bar'])->willReturn($category);

$this->getCategoryByCode('bar');
}

function it_provides_a_tree_from_his_code($categoryRepository, CategoryInterface $tree)
{
$categoryRepository->findOneBy(['code' => 'foo', 'parent' => null])->willReturn($tree);

$this->getTreeByCode('foo')->shouldReturn($tree);
}
}

This file was deleted.

Loading

0 comments on commit db9eb9a

Please sign in to comment.