Skip to content

Commit

Permalink
Merge branch '4.4' into 5.1
Browse files Browse the repository at this point in the history
* 4.4:
  Use createMock() and use import instead of FQCN
  • Loading branch information
nicolas-grekas committed Jan 27, 2021
2 parents af3af2b + 3a3ea59 commit 5aed487
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions Tests/InstantiatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@
namespace Symfony\Component\VarExporter\Tests;

use PHPUnit\Framework\TestCase;
use Symfony\Component\VarExporter\Exception\ClassNotFoundException;
use Symfony\Component\VarExporter\Exception\NotInstantiableTypeException;
use Symfony\Component\VarExporter\Instantiator;

class InstantiatorTest extends TestCase
{
public function testNotFoundClass()
{
$this->expectException(\Symfony\Component\VarExporter\Exception\ClassNotFoundException::class);
$this->expectException(ClassNotFoundException::class);
$this->expectExceptionMessage('Class "SomeNotExistingClass" not found.');
Instantiator::instantiate('SomeNotExistingClass');
}
Expand All @@ -28,7 +30,7 @@ public function testNotFoundClass()
*/
public function testFailingInstantiation(string $class)
{
$this->expectException(\Symfony\Component\VarExporter\Exception\NotInstantiableTypeException::class);
$this->expectException(NotInstantiableTypeException::class);
$this->expectExceptionMessageMatches('/Type ".*" is not instantiable\./');
Instantiator::instantiate($class);
}
Expand Down
6 changes: 4 additions & 2 deletions Tests/VarExporterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

use PHPUnit\Framework\TestCase;
use Symfony\Component\VarDumper\Test\VarDumperTestTrait;
use Symfony\Component\VarExporter\Exception\ClassNotFoundException;
use Symfony\Component\VarExporter\Exception\NotInstantiableTypeException;
use Symfony\Component\VarExporter\Internal\Registry;
use Symfony\Component\VarExporter\VarExporter;

Expand All @@ -22,7 +24,7 @@ class VarExporterTest extends TestCase

public function testPhpIncompleteClassesAreForbidden()
{
$this->expectException(\Symfony\Component\VarExporter\Exception\ClassNotFoundException::class);
$this->expectException(ClassNotFoundException::class);
$this->expectExceptionMessage('Class "SomeNotExistingClass" not found.');
$unserializeCallback = ini_set('unserialize_callback_func', 'var_dump');
try {
Expand All @@ -37,7 +39,7 @@ public function testPhpIncompleteClassesAreForbidden()
*/
public function testFailingSerialization($value)
{
$this->expectException(\Symfony\Component\VarExporter\Exception\NotInstantiableTypeException::class);
$this->expectException(NotInstantiableTypeException::class);
$this->expectExceptionMessageMatches('/Type ".*" is not instantiable\./');
$expectedDump = $this->getDump($value);
try {
Expand Down

0 comments on commit 5aed487

Please sign in to comment.