Skip to content

Commit 6ea59f4

Browse files
committed
CS fixes
1 parent 04fc310 commit 6ea59f4

File tree

6 files changed

+51
-90
lines changed

6 files changed

+51
-90
lines changed

lib/Parameters/ParameterType/ChannelType.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
use Netgen\Layouts\Parameters\ParameterType;
99
use Netgen\Layouts\Parameters\ValueObjectProviderInterface;
1010
use Netgen\Layouts\Sylius\Validator\Constraint as SyliusConstraints;
11-
use Sylius\Component\Channel\Model\ChannelInterface;
1211
use Sylius\Component\Channel\Repository\ChannelRepositoryInterface;
1312
use Symfony\Component\OptionsResolver\OptionsResolver;
1413
use Symfony\Component\Validator\Constraints;
@@ -35,7 +34,7 @@ public function configureOptions(OptionsResolver $optionsResolver): void
3534
$optionsResolver->setAllowedTypes('multiple', 'bool');
3635
}
3736

38-
public function getValueObject($value): ?ChannelInterface
37+
public function getValueObject($value): ?object
3938
{
4039
return $this->channelRepository->find($value);
4140
}

lib/Parameters/ParameterType/ProductType.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
use Netgen\Layouts\Parameters\ParameterType;
99
use Netgen\Layouts\Parameters\ValueObjectProviderInterface;
1010
use Netgen\Layouts\Sylius\Validator\Constraint as SyliusConstraints;
11-
use Sylius\Component\Product\Model\ProductInterface;
1211
use Sylius\Component\Product\Repository\ProductRepositoryInterface;
1312
use Symfony\Component\Validator\Constraints;
1413

@@ -27,7 +26,7 @@ public static function getIdentifier(): string
2726
return 'sylius_product';
2827
}
2928

30-
public function getValueObject($value): ?ProductInterface
29+
public function getValueObject($value): ?object
3130
{
3231
return $this->productRepository->find($value);
3332
}

lib/Parameters/ParameterType/TaxonType.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
use Netgen\Layouts\Parameters\ParameterType;
99
use Netgen\Layouts\Parameters\ValueObjectProviderInterface;
1010
use Netgen\Layouts\Sylius\Validator\Constraint as SyliusConstraints;
11-
use Sylius\Component\Taxonomy\Model\TaxonInterface;
1211
use Sylius\Component\Taxonomy\Repository\TaxonRepositoryInterface;
1312
use Symfony\Component\Validator\Constraints;
1413

@@ -27,7 +26,7 @@ public static function getIdentifier(): string
2726
return 'sylius_taxon';
2827
}
2928

30-
public function getValueObject($value): ?TaxonInterface
29+
public function getValueObject($value): ?object
3130
{
3231
return $this->taxonRepository->find($value);
3332
}

tests/lib/Parameters/ParameterType/ChannelTypeTest.php

Lines changed: 16 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
namespace Netgen\Layouts\Sylius\Tests\Parameters\ParameterType;
66

77
use Netgen\Layouts\Parameters\ParameterDefinition;
8-
use Netgen\Layouts\Parameters\ParameterTypeInterface;
98
use Netgen\Layouts\Sylius\Parameters\ParameterType\ChannelType;
109
use Netgen\Layouts\Sylius\Tests\Stubs\Channel as ChannelStub;
1110
use Netgen\Layouts\Sylius\Tests\Validator\RepositoryValidatorFactory;
@@ -23,9 +22,6 @@ final class ChannelTypeTest extends TestCase
2322
{
2423
use ParameterTypeTestTrait;
2524

26-
/** @var \Netgen\Layouts\Sylius\Parameters\ParameterType\ChannelType */
27-
private ParameterTypeInterface $type;
28-
2925
private MockObject&ChannelRepositoryInterface $repositoryMock;
3026

3127
protected function setUp(): void
@@ -110,30 +106,6 @@ public static function invalidOptionsDataProvider(): iterable
110106
];
111107
}
112108

113-
public function testValueObjectNull(): void
114-
{
115-
$this->repositoryMock
116-
->expects(self::once())
117-
->method('find')
118-
->with(self::identicalTo(null))
119-
->willReturn(null);
120-
121-
self::assertNull($this->type->getValueObject(null));
122-
}
123-
124-
public function testValueObjectIsValidObject(): void
125-
{
126-
$stub = new ChannelStub(1, 'test', 'test');
127-
128-
$this->repositoryMock
129-
->expects(self::once())
130-
->method('find')
131-
->with(self::identicalTo(1))
132-
->willReturn($stub);
133-
134-
self::assertSame($stub, $this->type->getValueObject(1));
135-
}
136-
137109
public function testValidationValid(): void
138110
{
139111
$this->repositoryMock
@@ -196,4 +168,20 @@ public static function emptyDataProvider(): iterable
196168
[new ChannelStub(42, 'WEBSHOP', 'Webshop'), false],
197169
];
198170
}
171+
172+
public function testGetValueObject(): void
173+
{
174+
$stub = new ChannelStub(1, 'test', 'test');
175+
176+
$this->repositoryMock
177+
->expects(self::once())
178+
->method('find')
179+
->with(self::identicalTo(1))
180+
->willReturn($stub);
181+
182+
/** @var \Netgen\Layouts\Sylius\Parameters\ParameterType\ChannelType $type */
183+
$type = $this->type;
184+
185+
self::assertSame($stub, $type->getValueObject(1));
186+
}
199187
}

tests/lib/Parameters/ParameterType/ProductTypeTest.php

Lines changed: 16 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
namespace Netgen\Layouts\Sylius\Tests\Parameters\ParameterType;
66

77
use Netgen\Layouts\Parameters\ParameterDefinition;
8-
use Netgen\Layouts\Parameters\ParameterTypeInterface;
98
use Netgen\Layouts\Sylius\Parameters\ParameterType\ProductType;
109
use Netgen\Layouts\Sylius\Tests\Stubs\Product as ProductStub;
1110
use Netgen\Layouts\Sylius\Tests\Validator\RepositoryValidatorFactory;
@@ -23,9 +22,6 @@ final class ProductTypeTest extends TestCase
2322
{
2423
use ParameterTypeTestTrait;
2524

26-
/** @var \Netgen\Layouts\Sylius\Parameters\ParameterType\ProductType */
27-
private ParameterTypeInterface $type;
28-
2925
private MockObject&ProductRepositoryInterface $repositoryMock;
3026

3127
protected function setUp(): void
@@ -89,30 +85,6 @@ public static function invalidOptionsDataProvider(): iterable
8985
];
9086
}
9187

92-
public function testValueObjectNull(): void
93-
{
94-
$this->repositoryMock
95-
->expects(self::once())
96-
->method('find')
97-
->with(self::identicalTo(null))
98-
->willReturn(null);
99-
100-
self::assertNull($this->type->getValueObject(null));
101-
}
102-
103-
public function testValueObjectIsValidObject(): void
104-
{
105-
$stub = new ProductStub(1);
106-
107-
$this->repositoryMock
108-
->expects(self::once())
109-
->method('find')
110-
->with(self::identicalTo(1))
111-
->willReturn($stub);
112-
113-
self::assertSame($stub, $this->type->getValueObject(1));
114-
}
115-
11688
public function testValidationValid(): void
11789
{
11890
$this->repositoryMock
@@ -175,4 +147,20 @@ public static function emptyDataProvider(): iterable
175147
[new ProductStub(42), false],
176148
];
177149
}
150+
151+
public function testGetValueObject(): void
152+
{
153+
$stub = new ProductStub(1);
154+
155+
$this->repositoryMock
156+
->expects(self::once())
157+
->method('find')
158+
->with(self::identicalTo(1))
159+
->willReturn($stub);
160+
161+
/** @var \Netgen\Layouts\Sylius\Parameters\ParameterType\ProductType $type */
162+
$type = $this->type;
163+
164+
self::assertSame($stub, $type->getValueObject(1));
165+
}
178166
}

tests/lib/Parameters/ParameterType/TaxonTypeTest.php

Lines changed: 16 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
namespace Netgen\Layouts\Sylius\Tests\Parameters\ParameterType;
66

77
use Netgen\Layouts\Parameters\ParameterDefinition;
8-
use Netgen\Layouts\Parameters\ParameterTypeInterface;
98
use Netgen\Layouts\Sylius\Parameters\ParameterType\TaxonType;
109
use Netgen\Layouts\Sylius\Tests\Stubs\Taxon as TaxonStub;
1110
use Netgen\Layouts\Sylius\Tests\Validator\RepositoryValidatorFactory;
@@ -23,9 +22,6 @@ final class TaxonTypeTest extends TestCase
2322
{
2423
use ParameterTypeTestTrait;
2524

26-
/** @var \Netgen\Layouts\Sylius\Parameters\ParameterType\TaxonType */
27-
private ParameterTypeInterface $type;
28-
2925
private MockObject&TaxonRepositoryInterface $repositoryMock;
3026

3127
protected function setUp(): void
@@ -89,30 +85,6 @@ public static function invalidOptionsDataProvider(): iterable
8985
];
9086
}
9187

92-
public function testValueObjectNull(): void
93-
{
94-
$this->repositoryMock
95-
->expects(self::once())
96-
->method('find')
97-
->with(self::identicalTo(null))
98-
->willReturn(null);
99-
100-
self::assertNull($this->type->getValueObject(null));
101-
}
102-
103-
public function testValueObjectIsValidObject(): void
104-
{
105-
$stub = new TaxonStub(1);
106-
107-
$this->repositoryMock
108-
->expects(self::once())
109-
->method('find')
110-
->with(self::identicalTo(1))
111-
->willReturn($stub);
112-
113-
self::assertSame($stub, $this->type->getValueObject(1));
114-
}
115-
11688
public function testValidationValid(): void
11789
{
11890
$this->repositoryMock
@@ -175,4 +147,20 @@ public static function emptyDataProvider(): iterable
175147
[new TaxonStub(42), false],
176148
];
177149
}
150+
151+
public function testGetValueObject(): void
152+
{
153+
$stub = new TaxonStub(1);
154+
155+
$this->repositoryMock
156+
->expects(self::once())
157+
->method('find')
158+
->with(self::identicalTo(1))
159+
->willReturn($stub);
160+
161+
/** @var \Netgen\Layouts\Sylius\Parameters\ParameterType\TaxonType $type */
162+
$type = $this->type;
163+
164+
self::assertSame($stub, $type->getValueObject(1));
165+
}
178166
}

0 commit comments

Comments
 (0)