Skip to content

Commit

Permalink
EZP-31810: Adapted code for 6.13 requirements (#3063)
Browse files Browse the repository at this point in the history
  • Loading branch information
adamwojs authored Sep 16, 2020
1 parent d86c763 commit 0f3dd70
Show file tree
Hide file tree
Showing 24 changed files with 50 additions and 80 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
* @copyright Copyright (C) eZ Systems AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/
declare(strict_types=1);

namespace eZ\Publish\Core\MVC\Symfony\Component\Serializer;

use Symfony\Component\Serializer\Normalizer\PropertyNormalizer;
Expand All @@ -27,5 +25,5 @@ public function normalize($object, $format = null, array $context = [])
/**
* @return string[]
*/
abstract protected function getAllowedProperties(): array;
abstract protected function getAllowedProperties();
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function normalize($object, $format = null, array $context = [])
return $data;
}

protected function getAllowedProperties(): array
protected function getAllowedProperties()
{
return ['subMatchers'];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
* @copyright Copyright (C) eZ Systems AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/
declare(strict_types=1);

namespace eZ\Publish\Core\MVC\Symfony\Component\Serializer;

use eZ\Publish\Core\MVC\Symfony\SiteAccess\Matcher\HostElement;
Expand All @@ -20,7 +18,7 @@ public function supportsNormalization($data, $format = null)
/**
* @see \eZ\Publish\Core\MVC\Symfony\SiteAccess\Matcher\HostElement::__sleep
*/
protected function getAllowedProperties(): array
protected function getAllowedProperties()
{
return ['elementNumber', 'hostElements'];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,13 @@
* @copyright Copyright (C) eZ Systems AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/
declare(strict_types=1);

namespace eZ\Publish\Core\MVC\Symfony\Component\Serializer;

use eZ\Publish\Core\MVC\Symfony\SiteAccess\Matcher\HostText;

final class HostTextNormalizer extends AbstractPropertyWhitelistNormalizer
{
protected function getAllowedProperties(): array
protected function getAllowedProperties()
{
return ['siteAccessesConfiguration'];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
* @copyright Copyright (C) eZ Systems AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/
declare(strict_types=1);

namespace eZ\Publish\Core\MVC\Symfony\Component\Serializer;

use eZ\Publish\Core\MVC\Symfony\SiteAccess\Matcher\Map;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,13 @@
* @copyright Copyright (C) eZ Systems AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/
declare(strict_types=1);

namespace eZ\Publish\Core\MVC\Symfony\Component\Serializer;

use eZ\Publish\Core\MVC\Symfony\SiteAccess\Matcher\Regex\Host;

final class RegexHostNormalizer extends AbstractPropertyWhitelistNormalizer
{
protected function getAllowedProperties(): array
protected function getAllowedProperties()
{
return ['siteAccessesConfiguration'];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
* @copyright Copyright (C) eZ Systems AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/
declare(strict_types=1);

namespace eZ\Publish\Core\MVC\Symfony\Component\Serializer;

use eZ\Publish\Core\MVC\Symfony\SiteAccess\Matcher\Regex;
Expand All @@ -20,7 +18,7 @@ public function supportsNormalization($data, $format = null)
/**
* @see \eZ\Publish\Core\MVC\Symfony\SiteAccess\Matcher\Regex::__sleep
*/
protected function getAllowedProperties(): array
protected function getAllowedProperties()
{
return ['regex', 'itemNumber', 'matchedSiteAccess'];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,13 @@
* @copyright Copyright (C) eZ Systems AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/
declare(strict_types=1);

namespace eZ\Publish\Core\MVC\Symfony\Component\Serializer;

use eZ\Publish\Core\MVC\Symfony\SiteAccess\Matcher\Regex\URI;

final class RegexURINormalizer extends AbstractPropertyWhitelistNormalizer
{
protected function getAllowedProperties(): array
protected function getAllowedProperties()
{
return ['siteAccessesConfiguration'];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
* @copyright Copyright (C) eZ Systems AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/
declare(strict_types=1);

namespace eZ\Publish\Core\MVC\Symfony\Component\Serializer;

use eZ\Publish\Core\MVC\Symfony\SiteAccess\Matcher\URIElement;
Expand All @@ -20,7 +18,7 @@ public function supportsNormalization($data, $format = null)
/**
* @see \eZ\Publish\Core\MVC\Symfony\SiteAccess\Matcher\URIElement::__sleep
*/
protected function getAllowedProperties(): array
protected function getAllowedProperties()
{
return ['elementNumber', 'uriElements'];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,13 @@
* @copyright Copyright (C) eZ Systems AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/
declare(strict_types=1);

namespace eZ\Publish\Core\MVC\Symfony\Component\Serializer;

use eZ\Publish\Core\MVC\Symfony\SiteAccess\Matcher\URIText;

final class URITextNormalizer extends AbstractPropertyWhitelistNormalizer
{
protected function getAllowedProperties(): array
protected function getAllowedProperties()
{
return ['siteAccessesConfiguration'];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
* @copyright Copyright (C) eZ Systems AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/
declare(strict_types=1);

namespace eZ\Publish\Core\MVC\Symfony\Component\Tests\Serializer;

use eZ\Publish\Core\MVC\Symfony\Component\Serializer\CompoundMatcherNormalizer;
Expand All @@ -18,7 +16,7 @@

final class CompoundMatcherNormalizerTest extends TestCase
{
public function testNormalization(): void
public function testNormalization()
{
$matcher = new CompoundStub([]);
$matcher->setSubMatchers([
Expand All @@ -44,7 +42,7 @@ public function testNormalization(): void
);
}

public function testSupportsNormalization(): void
public function testSupportsNormalization()
{
$normalizer = new CompoundMatcherNormalizer();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
* @copyright Copyright (C) eZ Systems AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/
declare(strict_types=1);

namespace eZ\Publish\Core\MVC\Symfony\Component\Tests\Serializer;

use eZ\Publish\Core\MVC\Symfony\Component\Serializer\HostElementNormalizer;
Expand All @@ -17,7 +15,7 @@

final class HostElementNormalizerTest extends TestCase
{
public function testNormalization(): void
public function testNormalization()
{
$normalizer = new HostElementNormalizer();
$normalizer->setSerializer(new SerializerStub());
Expand All @@ -39,7 +37,7 @@ public function testNormalization(): void
);
}

public function testSupportsNormalization(): void
public function testSupportsNormalization()
{
$normalizer = new HostElementNormalizer();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
* @copyright Copyright (C) eZ Systems AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/
declare(strict_types=1);

namespace eZ\Publish\Core\MVC\Symfony\Component\Tests\Serializer;

use eZ\Publish\Core\MVC\Symfony\Component\Serializer\HostTextNormalizer;
Expand All @@ -16,7 +14,7 @@

final class HostTextNormalizerTest extends TestCase
{
public function testNormalize(): void
public function testNormalize()
{
$normalizer = new HostTextNormalizer();
$normalizer->setSerializer(new SerializerStub());
Expand All @@ -37,7 +35,7 @@ public function testNormalize(): void
);
}

public function testSupportsNormalization(): void
public function testSupportsNormalization()
{
$normalizer = new HostTextNormalizer();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
* @copyright Copyright (C) eZ Systems AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/
declare(strict_types=1);

namespace eZ\Publish\Core\MVC\Symfony\Component\Tests\Serializer;

use eZ\Publish\Core\MVC\Symfony\Component\Serializer\MapNormalizer;
Expand All @@ -15,7 +13,7 @@

final class MapNormalizerTest extends TestCase
{
public function testNormalization(): void
public function testNormalization()
{
$normalizer = new MapNormalizer();

Expand All @@ -32,7 +30,7 @@ public function testNormalization(): void
);
}

public function testSupportsNormalization(): void
public function testSupportsNormalization()
{
$normalizer = new MapNormalizer();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
* @copyright Copyright (C) eZ Systems AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/
declare(strict_types=1);

namespace eZ\Publish\Core\MVC\Symfony\Component\Tests\Serializer;

use eZ\Publish\Core\MVC\Symfony\Component\Serializer\RegexHostNormalizer;
Expand All @@ -16,7 +14,7 @@

final class RegexHostNormalizerTest extends TestCase
{
public function testNormalize(): void
public function testNormalize()
{
$normalizer = new RegexHostNormalizer();
$normalizer->setSerializer(new SerializerStub());
Expand All @@ -37,7 +35,7 @@ public function testNormalize(): void
);
}

public function testSupportsNormalization(): void
public function testSupportsNormalization()
{
$normalizer = new RegexHostNormalizer();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,20 @@
* @copyright Copyright (C) eZ Systems AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/
declare(strict_types=1);

namespace eZ\Publish\Core\MVC\Symfony\Component\Tests\Serializer;

use eZ\Publish\API\Repository\Exceptions\NotImplementedException;
use eZ\Publish\Core\MVC\Symfony\Component\Serializer\RegexNormalizer;
use eZ\Publish\Core\MVC\Symfony\SiteAccess\Matcher;
use eZ\Publish\Core\MVC\Symfony\SiteAccess\Matcher\Regex as RegexMatcher;
use eZ\Publish\Core\MVC\Symfony\Component\Tests\Serializer\Stubs\RegexMatcher as RegexMatcherStub;
use PHPUnit\Framework\TestCase;

final class RegexNormalizerTest extends TestCase
{
public function testNormalize(): void
public function testNormalize()
{
$normalizer = new RegexNormalizer();

$matcher = new class('/^Foo(.*)/(.*)/', 2) extends RegexMatcher {
public function getName()
{
throw new NotImplementedException(__METHOD__);
}
};
$matcher = new RegexMatcherStub('/^Foo(.*)/(.*)/', 2);

$this->assertEquals(
[
Expand All @@ -37,7 +29,7 @@ public function getName()
);
}

public function testSupportsNormalization(): void
public function testSupportsNormalization()
{
$normalizer = new RegexNormalizer();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
* @copyright Copyright (C) eZ Systems AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/
declare(strict_types=1);

namespace eZ\Publish\Core\MVC\Symfony\Component\Tests\Serializer;

use eZ\Publish\Core\MVC\Symfony\Component\Serializer\RegexURINormalizer;
Expand All @@ -16,7 +14,7 @@

final class RegexURINormalizerTest extends TestCase
{
public function testNormalize(): void
public function testNormalize()
{
$normalizer = new RegexURINormalizer();
$normalizer->setSerializer(new SerializerStub());
Expand All @@ -37,7 +35,7 @@ public function testNormalize(): void
);
}

public function testSupportsNormalization(): void
public function testSupportsNormalization()
{
$normalizer = new RegexURINormalizer();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
* @copyright Copyright (C) eZ Systems AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/
declare(strict_types=1);

namespace eZ\Publish\Core\MVC\Symfony\Component\Tests\Serializer\Stubs;

use eZ\Publish\API\Repository\Exceptions\NotImplementedException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
* @copyright Copyright (C) eZ Systems AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/
declare(strict_types=1);

namespace eZ\Publish\Core\MVC\Symfony\Component\Tests\Serializer\Stubs;

use eZ\Publish\API\Repository\Exceptions\NotImplementedException;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

/**
* @copyright Copyright (C) eZ Systems AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/
namespace eZ\Publish\Core\MVC\Symfony\Component\Tests\Serializer\Stubs;

use eZ\Publish\API\Repository\Exceptions\NotImplementedException;
use eZ\Publish\Core\MVC\Symfony\SiteAccess\Matcher\Regex as BaseRegex;

final class RegexMatcher extends BaseRegex
{
public function getName()
{
throw new NotImplementedException(__METHOD__);
}
}
Loading

0 comments on commit 0f3dd70

Please sign in to comment.