Skip to content

Commit 48e8041

Browse files
committed
[Serializer] Use ::class in new tests
1 parent 26ad4ff commit 48e8041

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/Symfony/Component/Serializer/Tests/Mapping/Factory/CacheMetadataFactoryTest.php

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@
1313

1414
use Symfony\Component\Cache\Adapter\ArrayAdapter;
1515
use Symfony\Component\Serializer\Mapping\ClassMetadata;
16+
use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface;
1617
use Symfony\Component\Serializer\Mapping\Factory\CacheClassMetadataFactory;
18+
use Symfony\Component\Serializer\Tests\Fixtures\Dummy;
1719

1820
/**
1921
* @author Kévin Dunglas <dunglas@gmail.com>
@@ -22,9 +24,9 @@ class CacheMetadataFactoryTest extends \PHPUnit_Framework_TestCase
2224
{
2325
public function testGetMetadataFor()
2426
{
25-
$metadata = new ClassMetadata('Symfony\Component\Serializer\Tests\Fixtures\Dummy');
27+
$metadata = new ClassMetadata(Dummy::class);
2628

27-
$decorated = $this->getMock('Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface');
29+
$decorated = $this->getMock(ClassMetadataFactoryInterface::class);
2830
$decorated
2931
->expects($this->once())
3032
->method('getMetadataFor')
@@ -33,14 +35,14 @@ public function testGetMetadataFor()
3335

3436
$factory = new CacheClassMetadataFactory($decorated, new ArrayAdapter());
3537

36-
$this->assertEquals($metadata, $factory->getMetadataFor('Symfony\Component\Serializer\Tests\Fixtures\Dummy'));
38+
$this->assertEquals($metadata, $factory->getMetadataFor(Dummy::class));
3739
// The second call should retrieve the value from the cache
38-
$this->assertEquals($metadata, $factory->getMetadataFor('Symfony\Component\Serializer\Tests\Fixtures\Dummy'));
40+
$this->assertEquals($metadata, $factory->getMetadataFor(Dummy::class));
3941
}
4042

4143
public function testHasMetadataFor()
4244
{
43-
$decorated = $this->getMock('Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface');
45+
$decorated = $this->getMock(ClassMetadataFactoryInterface::class);
4446
$decorated
4547
->expects($this->once())
4648
->method('hasMetadataFor')
@@ -49,15 +51,15 @@ public function testHasMetadataFor()
4951

5052
$factory = new CacheClassMetadataFactory($decorated, new ArrayAdapter());
5153

52-
$this->assertTrue($factory->hasMetadataFor('Symfony\Component\Serializer\Tests\Fixtures\Dummy'));
54+
$this->assertTrue($factory->hasMetadataFor(Dummy::class));
5355
}
5456

5557
/**
5658
* @expectedException \Symfony\Component\Serializer\Exception\InvalidArgumentException
5759
*/
5860
public function testInvalidClassThrowsException()
5961
{
60-
$decorated = $this->getMock('Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface');
62+
$decorated = $this->getMock(ClassMetadataFactoryInterface::class);
6163
$factory = new CacheClassMetadataFactory($decorated, new ArrayAdapter());
6264

6365
$factory->getMetadataFor('Not\Exist');

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy