Skip to content

Commit 3e5d629

Browse files
author
abluchet
committed
Style fixes
1 parent d928fd1 commit 3e5d629

File tree

8 files changed

+19
-23
lines changed

8 files changed

+19
-23
lines changed

tests/Annotation/ApiResourceTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
namespace ApiPlatform\Core\Tests\Annotation;
1515

1616
use ApiPlatform\Core\Annotation\ApiResource;
17+
use ApiPlatform\Core\Exception\InvalidArgumentException;
1718
use ApiPlatform\Core\Tests\Fixtures\AnnotatedClass;
1819
use Doctrine\Common\Annotations\AnnotationReader;
1920
use PHPUnit\Framework\TestCase;
@@ -102,12 +103,11 @@ public function testApiResourceAnnotation()
102103
], $resource->attributes);
103104
}
104105

105-
/**
106-
* @expectedException \ApiPlatform\Core\Exception\InvalidArgumentException
107-
* @expectedExceptionMessage Unknown property "invalidAttribute" on annotation "ApiPlatform\Core\Annotation\ApiResource".
108-
*/
109106
public function testConstructWithInvalidAttribute()
110107
{
108+
$this->expectException(InvalidArgumentException::class);
109+
$this->expectExceptionMessage('Unknown property "invalidAttribute" on annotation "ApiPlatform\\Core\\Annotation\\ApiResource".');
110+
111111
new ApiResource([
112112
'shortName' => 'shortName',
113113
'routePrefix' => '/foo',

tests/Bridge/Doctrine/Orm/ItemDataProviderTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
use ApiPlatform\Core\Bridge\Doctrine\Orm\Extension\QueryResultItemExtensionInterface;
1818
use ApiPlatform\Core\Bridge\Doctrine\Orm\ItemDataProvider;
1919
use ApiPlatform\Core\Bridge\Doctrine\Orm\Util\QueryNameGeneratorInterface;
20-
use ApiPlatform\Core\Identifier\Normalizer\ChainIdentifierDenormalizer;
2120
use ApiPlatform\Core\Exception\PropertyNotFoundException;
2221
use ApiPlatform\Core\Exception\RuntimeException;
22+
use ApiPlatform\Core\Identifier\Normalizer\ChainIdentifierDenormalizer;
2323
use ApiPlatform\Core\Metadata\Property\Factory\PropertyMetadataFactoryInterface;
2424
use ApiPlatform\Core\Metadata\Property\Factory\PropertyNameCollectionFactoryInterface;
2525
use ApiPlatform\Core\Metadata\Property\PropertyMetadata;

tests/Bridge/Doctrine/Orm/SubresourceDataProviderTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
use ApiPlatform\Core\Bridge\Doctrine\Orm\Extension\QueryResultCollectionExtensionInterface;
1717
use ApiPlatform\Core\Bridge\Doctrine\Orm\SubresourceDataProvider;
1818
use ApiPlatform\Core\Bridge\Doctrine\Orm\Util\QueryNameGeneratorInterface;
19-
use ApiPlatform\Core\Identifier\Normalizer\ChainIdentifierDenormalizer;
2019
use ApiPlatform\Core\Exception\ResourceClassNotSupportedException;
2120
use ApiPlatform\Core\Exception\RuntimeException;
21+
use ApiPlatform\Core\Identifier\Normalizer\ChainIdentifierDenormalizer;
2222
use ApiPlatform\Core\Metadata\Property\Factory\PropertyMetadataFactoryInterface;
2323
use ApiPlatform\Core\Metadata\Property\Factory\PropertyNameCollectionFactoryInterface;
2424
use ApiPlatform\Core\Metadata\Property\PropertyMetadata;

tests/Bridge/Doctrine/Orm/Util/IdentifierManagerTraitTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public function testCompositeIdentifier()
9393
public function testInvalidIdentifier()
9494
{
9595
$this->expectException(PropertyNotFoundException::class);
96-
$this->expectExceptionMessage('Invalid identifier "idbad=1;idb=2", "ida" has not been found.');
96+
$this->expectExceptionMessage('Invalid identifier "idbad=1;idb=2", "ida" was not found.');
9797

9898
list($propertyNameCollectionFactory, $propertyMetadataFactory) = $this->getMetadataFactories(Dummy::class, [
9999
'ida',

tests/Bridge/RamseyUuid/Normalizer/UuidNormalizerTest.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,10 @@ public function testNoSupportDenormalizeUuid()
3434
$this->assertFalse($normalizer->supportsDenormalization($uuid, ''));
3535
}
3636

37-
/**
38-
* @expectedException \ApiPlatform\Core\Exception\InvalidIdentifierException
39-
*/
4037
public function testFailDenormalizeUuid()
4138
{
39+
$this->expectException(\ApiPlatform\Core\Exception\InvalidIdentifierException::class);
40+
4241
$uuid = 'notanuuid';
4342
$normalizer = new UuidNormalizer();
4443
$this->assertTrue($normalizer->supportsDenormalization($uuid, Uuid::class));

tests/Bridge/Symfony/Routing/IriConverterTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@
2121
use ApiPlatform\Core\Bridge\Symfony\Routing\RouteNameResolverInterface;
2222
use ApiPlatform\Core\DataProvider\ItemDataProviderInterface;
2323
use ApiPlatform\Core\DataProvider\SubresourceDataProviderInterface;
24-
use ApiPlatform\Core\Exception\InvalidIdentifierException;
25-
use ApiPlatform\Core\Identifier\Normalizer\ChainIdentifierDenormalizer;
2624
use ApiPlatform\Core\Exception\InvalidArgumentException;
25+
use ApiPlatform\Core\Exception\InvalidIdentifierException;
2726
use ApiPlatform\Core\Exception\ItemNotFoundException;
27+
use ApiPlatform\Core\Identifier\Normalizer\ChainIdentifierDenormalizer;
2828
use ApiPlatform\Core\Metadata\Property\Factory\PropertyMetadataFactoryInterface;
2929
use ApiPlatform\Core\Metadata\Property\Factory\PropertyNameCollectionFactoryInterface;
3030
use ApiPlatform\Core\Tests\Fixtures\TestBundle\Entity\Dummy;
@@ -280,7 +280,7 @@ public function testGetItemFromIriBadIdentifierException()
280280
'id' => 3,
281281
])->shouldBeCalledTimes(1);
282282
$identifierDenormalizerProphecy = $this->prophesize(ChainIdentifierDenormalizer::class);
283-
$identifierDenormalizerProphecy->denormalize('3', Dummy::class)->shouldBeCalled()->willThrow(new InvalidIdentifierException('fail'));
283+
$identifierDenormalizerProphecy->denormalize('3', Dummy::class)->shouldBeCalled()->willThrow(new InvalidIdentifierException('Item not found for "/users/3".'));
284284
$converter = $this->getIriConverter($routerProphecy, $routeNameResolverProphecy, null, null, $identifierDenormalizerProphecy);
285285
$this->assertEquals($converter->getItemFromIri('/users/3', ['fetch_data' => true]), $item);
286286
}

tests/EventListener/ReadListenerTest.php

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
use ApiPlatform\Core\DataProvider\SubresourceDataProviderInterface;
1919
use ApiPlatform\Core\EventListener\ReadListener;
2020
use ApiPlatform\Core\Exception\InvalidIdentifierException;
21-
use ApiPlatform\Core\Identifier\Normalizer\ChainIdentifierDenormalizer;
2221
use ApiPlatform\Core\Exception\RuntimeException;
22+
use ApiPlatform\Core\Identifier\Normalizer\ChainIdentifierDenormalizer;
2323
use PHPUnit\Framework\TestCase;
2424
use Prophecy\Argument;
2525
use Symfony\Component\HttpFoundation\Request;
@@ -292,11 +292,10 @@ public function testRetrieveItemNotFound()
292292
$listener->onKernelRequest($event->reveal());
293293
}
294294

295-
/**
296-
* @expectedException \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
297-
*/
298295
public function testRetrieveBadItemNormalizedIdentifiers()
299296
{
297+
$this->expectException(NotFoundHttpException::class);
298+
300299
$identifierDenormalizer = $this->prophesize(ChainIdentifierDenormalizer::class);
301300
$identifierDenormalizer->denormalize('1', 'Foo')->shouldBeCalled()->willThrow(new InvalidIdentifierException());
302301

@@ -314,11 +313,10 @@ public function testRetrieveBadItemNormalizedIdentifiers()
314313
$listener->onKernelRequest($event->reveal());
315314
}
316315

317-
/**
318-
* @expectedException \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
319-
*/
320316
public function testRetrieveBadSubresourceNormalizedIdentifiers()
321317
{
318+
$this->expectException(NotFoundHttpException::class);
319+
322320
$identifierDenormalizer = $this->prophesize(ChainIdentifierDenormalizer::class);
323321
$identifierDenormalizer->denormalize(Argument::type('string'), Argument::type('string'))->shouldBeCalled()->willThrow(new InvalidIdentifierException());
324322

tests/Identifier/Normalizer/DateTimeIdentifierNormalizerTest.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,10 @@
2121
*/
2222
class DateTimeIdentifierNormalizerTest extends TestCase
2323
{
24-
/**
25-
* @expectedException \ApiPlatform\Core\Exception\InvalidIdentifierException
26-
*/
2724
public function testDenormalize()
2825
{
26+
$this->expectException(\ApiPlatform\Core\Exception\InvalidIdentifierException::class);
27+
2928
$normalizer = new DateTimeIdentifierDenormalizer();
3029
$normalizer->denormalize('not valid', \DateTimeImmutable::class);
3130
}

0 commit comments

Comments
 (0)