Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing usage of correct Interface #2

Open
wants to merge 4 commits into
base: 7.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .php-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
8.1
2 changes: 1 addition & 1 deletion Tests/Integration/AbstractTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace Pim\Bundle\ExtendedAttributeTypeBundle\Tests\Integration;

use Akeneo\Bundle\BatchBundle\Command\BatchCommand;
use Akeneo\Test\Integration\TestCase;
use Akeneo\Tool\Bundle\BatchBundle\Command\BatchCommand;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Output\BufferedOutput;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

namespace Pim\Bundle\ExtendedAttributeTypeBundle\Tests\Integration\Attribute;

use Akeneo\Pim\Structure\Component\Model\FamilyInterface;
use Akeneo\Tool\Component\StorageUtils\Exception\InvalidPropertyTypeException;
use Pim\Bundle\ExtendedAttributeTypeBundle\AttributeType\ExtendedAttributeTypes;
use Pim\Bundle\ExtendedAttributeTypeBundle\Tests\Integration\AbstractTestCase;
use Akeneo\Pim\Structure\Component\Model\AttributeInterface;
use Akeneo\Channel\Component\Model\FamilyInterface;

/**
* @author Mathias METAYER <mathias.metayer@akeneo.com>
Expand Down
10 changes: 5 additions & 5 deletions Tests/Integration/DataLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

namespace Pim\Bundle\ExtendedAttributeTypeBundle\Tests\Integration;

use Akeneo\Component\Batch\Model\JobInstance;
use Akeneo\Channel\Infrastructure\Component\Model\ChannelInterface;
use Akeneo\Channel\Infrastructure\Component\Repository\ChannelRepositoryInterface;
use Akeneo\Pim\Enrichment\Component\Product\Model\ProductInterface;
use Akeneo\Pim\Structure\Component\Model\AttributeInterface;
use Akeneo\Channel\Component\Model\ChannelInterface;
use Akeneo\Channel\Component\Model\FamilyInterface;
use Akeneo\Channel\Component\Model\ProductInterface;
use Pim\Component\Catalog\Repository\ChannelRepositoryInterface;
use Akeneo\Pim\Structure\Component\Model\FamilyInterface;
use Akeneo\Tool\Component\Batch\Model\JobInstance;
use Symfony\Component\DependencyInjection\ContainerInterface;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

namespace Pim\Bundle\ExtendedAttributeTypeBundle\Tests\Integration\Elasticsearch;

use Akeneo\Bundle\ElasticsearchBundle\Client;
use Akeneo\Pim\Enrichment\Component\Product\Query\ProductQueryBuilderFactoryInterface;
use Akeneo\Tool\Bundle\ElasticsearchBundle\Client;
use Pim\Bundle\ExtendedAttributeTypeBundle\AttributeType\ExtendedAttributeTypes;
use Pim\Bundle\ExtendedAttributeTypeBundle\Tests\Integration\AbstractTestCase;
use Akeneo\Pim\Structure\Component\Model\AttributeInterface;
use Akeneo\Pim\Enrichment\Component\Product\Query\Filter\Operators;
use Pim\Component\Catalog\Query\ProductQueryBuilderFactoryInterface;

/**
* @author Mathias METAYER <mathias.metayer@akeneo.com>
Expand Down
6 changes: 3 additions & 3 deletions Tests/Integration/Elasticsearch/TextCollectionFilterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

namespace Pim\Bundle\ExtendedAttributeTypeBundle\Tests\Integration\Elasticsearch;

use Akeneo\Pim\Enrichment\Component\Product\Model\ProductInterface;
use Akeneo\Pim\Enrichment\Component\Product\Query\ProductQueryBuilderFactoryInterface;
use Pim\Bundle\ExtendedAttributeTypeBundle\AttributeType\ExtendedAttributeTypes;
use Pim\Bundle\ExtendedAttributeTypeBundle\Tests\Integration\AbstractTestCase;
use Akeneo\Channel\Component\Model\ProductInterface;
use Akeneo\Pim\Enrichment\Component\Product\Query\Filter\Operators;
use Pim\Component\Catalog\Query\ProductQueryBuilderFactoryInterface;

/**
* @author Mathias METAYER <mathias.metayer@akeneo.com>
Expand All @@ -18,7 +18,7 @@ class TextCollectionFilterTest extends AbstractTestCase
/** @var ProductQueryBuilderFactoryInterface */
private $pqbFactory;

public function setUp()
public function setUp(): void
{
parent::setUp();
$this->loadData();
Expand Down
4 changes: 2 additions & 2 deletions Tests/Integration/Job/AbstractImportExportTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

namespace Pim\Bundle\ExtendedAttributeTypeBundle\Tests\Integration\Job;

use Akeneo\Pim\Structure\Component\AttributeTypes;
use Pim\Bundle\ExtendedAttributeTypeBundle\AttributeType\ExtendedAttributeTypes;
use Pim\Bundle\ExtendedAttributeTypeBundle\Tests\Integration\AbstractTestCase;
use Pim\Component\Catalog\AttributeTypes;

/**
* @author Mathias METAYER <mathias.metayer@akeneo.com>
Expand All @@ -22,7 +22,7 @@ class AbstractImportExportTestCase extends AbstractTestCase
/**
* {@inheritdoc}
*/
public function setUp()
public function setUp(): void
{
parent::setUp();
$this->loadData();
Expand Down
4 changes: 2 additions & 2 deletions Tests/Integration/Job/ExportTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace Pim\Bundle\ExtendedAttributeTypeBundle\Tests\Integration\Job;

use Akeneo\Bundle\BatchBundle\Command\BatchCommand;
use Akeneo\Pim\Enrichment\Component\Product\Query\Filter\Operators;
use Akeneo\Tool\Bundle\BatchBundle\Command\BatchCommand;
use Symfony\Component\Finder\Finder;

/**
Expand All @@ -16,7 +16,7 @@ class ExportTest extends AbstractImportExportTestCase
/**
* {@inheritdoc}
*/
public function tearDown()
public function tearDown(): void
{
$finder = new Finder();
$files = $finder->files()->name('*.csv')->in(static::$exportPath);
Expand Down
6 changes: 3 additions & 3 deletions Tests/Integration/Job/ImportTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

namespace Pim\Bundle\ExtendedAttributeTypeBundle\Tests\Integration\Job;

use Akeneo\Bundle\BatchBundle\Command\BatchCommand;
use Akeneo\Channel\Component\Model\ProductInterface;
use Akeneo\Pim\Enrichment\Component\Product\Model\ProductInterface;
use Akeneo\Pim\Enrichment\Component\Product\Query\Filter\Operators;
use Pim\Component\Catalog\Query\ProductQueryBuilderInterface;
use Akeneo\Pim\Enrichment\Component\Product\Query\ProductQueryBuilderInterface;
use Akeneo\Tool\Bundle\BatchBundle\Command\BatchCommand;

/**
* @author Mathias METAYER <mathias.metayer@akeneo.com>
Expand Down
2 changes: 1 addition & 1 deletion Tests/Integration/Product/CompletenessTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

namespace Pim\Bundle\ExtendedAttributeTypeBundle\Tests\Integration\Product;

use Akeneo\Pim\Structure\Component\AttributeTypes;
use Pim\Bundle\ExtendedAttributeTypeBundle\AttributeType\ExtendedAttributeTypes;
use Pim\Bundle\ExtendedAttributeTypeBundle\Tests\Integration\AbstractTestCase;
use Pim\Component\Catalog\AttributeTypes;
use Akeneo\Pim\Enrichment\Component\Product\Query\Filter\Operators;

/**
Expand Down
21 changes: 11 additions & 10 deletions Tests/Integration/Product/CreateProductTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,28 @@

namespace Pim\Bundle\ExtendedAttributeTypeBundle\Tests\Integration\Product;

use Akeneo\Pim\Enrichment\Component\Product\Model\ProductInterface;
use Akeneo\Pim\Enrichment\Component\Product\Repository\ProductRepositoryInterface;
use Akeneo\Pim\Enrichment\Component\Product\Updater\ProductUpdater;
use Pim\Bundle\ExtendedAttributeTypeBundle\AttributeType\ExtendedAttributeTypes;
use Pim\Bundle\ExtendedAttributeTypeBundle\Tests\Integration\AbstractTestCase;
use Akeneo\Channel\Component\Model\ProductInterface;
use Pim\Component\Catalog\Repository\ProductRepositoryInterface;
use Pim\Component\Catalog\Updater\ProductUpdater;
use Symfony\Component\DependencyInjection\ContainerInterface;

/**
* @author Romain Monceau <romain@akeneo.com>
* @copyright 2018 Akeneo SAS (http://www.akeneo.com)
*/
class CreateProductTest extends AbstractTestCase
{
/** @var ContainerInterface */
protected $container;
/**
* @var \Symfony\Component\DependencyInjection\ContainerInterface
*/
private $testContainer;

protected function setUp()
protected function setUp(): void
{
parent::setUp();

$this->container = static::$kernel->getContainer();
$this->testContainer = static::$kernel->getContainer();

$dataAttribute = ['code' => 'eans', 'type' => ExtendedAttributeTypes::TEXT_COLLECTION];
$this->getDataLoader()->createAttribute($dataAttribute);
Expand Down Expand Up @@ -146,15 +147,15 @@ private function getProductRepository()
*/
private function validate(ProductInterface $product)
{
return $this->container->get('pim_catalog.validator.product')->validate($product);
return $this->testContainer->get('pim_catalog.validator.product')->validate($product);
}

/**
* @param ProductInterface $product
*/
private function saveProduct(ProductInterface $product)
{
$this->container->get('pim_catalog.saver.product')->save($product);
$this->testContainer->get('pim_catalog.saver.product')->save($product);
$this->clear();
}
}
12 changes: 12 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
## Upgrade der Dependencies

### Abhängigkeiten updaten

unter src/Elasticsearch/Filter/Attribute/ProductProposalTextCollectionFilter.php müssen noch einige Klassen ersetzt werden!
Die verwendeten Klassen kommen noch aus einer anderen früheren PIM Version

Bitte dazu einmal mit https://github.com/akeneo/pim-community-dev/tree/v7.0.68/src vergleichen

Ggf muss hier auch noch die Changelog studiert werden.

Bitte die tests anpassen, so dass wir wissen das es weiterhin funktioniert.
8 changes: 7 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
},
"require-dev": {
"friendsofphp/php-cs-fixer": "@stable",
"phpspec/phpspec": "@stable"
"phpspec/phpspec": "@stable",
"phpunit/phpunit": "^10"
},
"autoload": {
"psr-4": {
Expand All @@ -34,5 +35,10 @@
"dev-2.0": "2.0.x-dev",
"dev-master": "2.1.x-dev"
}
},
"config": {
"allow-plugins": {
"symfony/flex": true
}
}
}
4 changes: 2 additions & 2 deletions src/Completeness/Checker/TextCollectionCompleteChecker.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

namespace Pim\Bundle\ExtendedAttributeTypeBundle\Completeness\Checker;

use Akeneo\Channel\Infrastructure\Component\Model\ChannelInterface;
use Akeneo\Channel\Infrastructure\Component\Model\LocaleInterface;
use Pim\Bundle\ExtendedAttributeTypeBundle\AttributeType\ExtendedAttributeTypes;
use Akeneo\Channel\Component\Model\ChannelInterface;
use Akeneo\Channel\Component\Model\LocaleInterface;

/**
* @author JM Leroux <jean-marie.leroux@akeneo.com>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
namespace Pim\Bundle\ExtendedAttributeTypeBundle\Completeness\MaskItemGenerator;

use Akeneo\Pim\Enrichment\Component\Product\Completeness\MaskItemGenerator\MaskItemGeneratorForAttributeType;
use Akeneo\Pim\Structure\Component\AttributeTypes;
use Pim\Bundle\ExtendedAttributeTypeBundle\AttributeType\ExtendedAttributeTypes;

class TextCollectionMaskItemGenerator implements MaskItemGeneratorForAttributeType
Expand Down
2 changes: 1 addition & 1 deletion src/DataGrid/Form/Type/Filter/TextCollectionFilterType.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Translation\TranslatorInterface;
use Symfony\Contracts\Translation\TranslatorInterface;

/**
* TextCollectionFilterType to display the grid filter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@

namespace Pim\Bundle\ExtendedAttributeTypeBundle\Elasticsearch\Filter\Attribute;

use Akeneo\Component\StorageUtils\Exception\InvalidPropertyTypeException;
use Pim\Component\Catalog\Exception\InvalidOperatorException;
use Pim\Component\Catalog\Model\AttributeInterface;
use Pim\Component\Catalog\Query\Filter\AttributeFilterInterface;
use Pim\Component\Catalog\Query\Filter\Operators;
use PimEnterprise\Bundle\WorkflowBundle\Elasticsearch\Filter\Attribute\AbstractAttributeFilter;
use Akeneo\Tool\Component\StorageUtils\Exception\InvalidPropertyTypeException;
use Akeneo\Pim\Enrichment\Bundle\Elasticsearch\Filter\Attribute\AbstractAttributeFilter;
use Akeneo\Pim\Enrichment\Component\Product\Query\Filter\AttributeFilterInterface;
use Akeneo\Pim\Enrichment\Component\Product\Query\Filter\Operators;
use Akeneo\Pim\Enrichment\Component\Product\Exception\InvalidOperatorException;
use PimEnterprise\Bundle\WorkflowBundle\Elasticsearch\Filter\Attribute\ProposalAttributePathResolver;

/**
Expand Down
1 change: 1 addition & 0 deletions src/Factory/Value/TextCollectionValueFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Pim\Bundle\ExtendedAttributeTypeBundle\Factory\Value;

use Akeneo\Pim\Enrichment\Component\Product\Factory\Value\ValueFactory;
use Akeneo\Pim\Structure\Component\Model\AttributeInterface;
use Akeneo\Tool\Component\StorageUtils\Exception\InvalidPropertyTypeException;
use Akeneo\Pim\Structure\Component\Query\PublicApi\AttributeType\Attribute;
use Akeneo\Pim\Enrichment\Component\Product\Model\ValueInterface;
Expand Down
2 changes: 1 addition & 1 deletion src/Model/TextCollectionValue.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
namespace Pim\Bundle\ExtendedAttributeTypeBundle\Model;

use Akeneo\Pim\Enrichment\Component\Product\Model\AbstractValue;
use Akeneo\Pim\Structure\Component\Model\AttributeInterface;
use Akeneo\Pim\Enrichment\Component\Product\Model\ValueInterface;
use Akeneo\Pim\Structure\Component\Model\AttributeInterface;
use Akeneo\Pim\Structure\Component\Query\PublicApi\AttributeType\Attribute;

/**
Expand Down
14 changes: 12 additions & 2 deletions src/Normalizer/Flat/TextCollectionDenormalizerFlat.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
namespace Pim\Bundle\ExtendedAttributeTypeBundle\Normalizer\Flat;

use Pim\Bundle\ExtendedAttributeTypeBundle\AttributeType\TextCollectionType;
use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait;
use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;

/**
* Denormalize flat text collection:
Expand All @@ -12,13 +14,16 @@
* @author JM Leroux <jean-marie.leroux@akeneo.com>
* @copyright 2017 Akeneo SAS (http://www.akeneo.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @method array getSupportedTypes(?string $format)
*/
class TextCollectionDenormalizerFlat extends Denormalizer
class TextCollectionDenormalizerFlat implements DenormalizerInterface
{
use DenormalizerAwareTrait;

/**
* {@inheritdoc}
*/
public function denormalize($data, $class, $format = null, array $context = [])
public function denormalize($data, string $type, ?string $format = null, array $context = [])
{
$data = ('' === $data) ? null : $data;

Expand All @@ -28,4 +33,9 @@ public function denormalize($data, $class, $format = null, array $context = [])

return $data;
}

public function supportsDenormalization(mixed $data, string $type, ?string $format = null)
{
return true;
}
}