Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jderusse committed Aug 1, 2019
1 parent 3a626e8 commit a22a9c4
Show file tree
Hide file tree
Showing 11 changed files with 13 additions and 22 deletions.
Expand Up @@ -15,7 +15,7 @@ class RegisterMappingsPassTest extends TestCase
public function testNoDriverParmeterException()
{
$this->expectException('InvalidArgumentException');
$this->getExpectedExceptionMessage('Could not find the manager name parameter in the container. Tried the following parameter names: "manager.param.one", "manager.param.two"');
$this->expectExceptionMessage('Could not find the manager name parameter in the container. Tried the following parameter names: "manager.param.one", "manager.param.two"');
$container = $this->createBuilder();
$this->process($container, [
'manager.param.one',
Expand Down
Expand Up @@ -68,7 +68,7 @@ public function testUnusedBinding()
public function testMissingParent()
{
$this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
$this->expectExceptionMessageRegExp('Unused binding "$quz" in service [\s\S]+ Invalid service ".*\\ParentNotExists": class NotExists not found\.');
$this->expectExceptionMessageRegExp('/Unused binding "\$quz" in service [\s\S]+/');
if (\PHP_VERSION_ID >= 70400) {
throw new Warning('PHP 7.4 breaks this test, see https://bugs.php.net/78351.');
}
Expand Down
Expand Up @@ -311,7 +311,7 @@ public function testTagWithEmptyNameThrowsException()
public function testTagWithNonStringNameThrowsException()
{
$this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
$this->expectExceptionMessageRegExp('The tag name for service "\.+" must be a non-empty string');
$this->expectExceptionMessageRegExp('/The tag name for service ".+" in .+ must be a non-empty string/');
$loader = new YamlFileLoader(new ContainerBuilder(), new FileLocator(self::$fixturesPath.'/yaml'));
$loader->load('tag_name_no_string.yml');
}
Expand Down
Expand Up @@ -20,8 +20,6 @@

class FormTest_AuthorWithoutRefSetter
{
use ForwardCompatTestTrait;

protected $reference;

protected $referenceCopy;
Expand Down Expand Up @@ -54,6 +52,8 @@ public function setReferenceCopy($reference)

class FormTypeTest extends BaseTypeTest
{
use ForwardCompatTestTrait;

const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\FormType';

public function testCreateFormInstances()
Expand Down
Expand Up @@ -12,19 +12,16 @@
namespace Symfony\Component\Form\Tests\Resources;

use PHPUnit\Framework\TestCase;
use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;

class TranslationFilesTest extends TestCase
{
use ForwardCompatTestTrait;

/**
* @dataProvider provideTranslationFiles
*/
public function testTranslationFileIsValid($filePath)
{
if (class_exists('PHPUnit_Util_XML')) {
\PHPUnit\Util\XML::loadfile($filePath, false, false, true);
\PHPUnit_Util_XML::loadfile($filePath, false, false, true);
} else {
\PHPUnit\Util\XML::loadfile($filePath, false, false, true);
}
Expand Down
Expand Up @@ -11,13 +11,15 @@

namespace Symfony\Component\Lock\Tests\Store;

use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
use Symfony\Component\Lock\Store\RedisStore;

/**
* @author Jérémy Derussé <jeremy@derusse.com>
*/
abstract class AbstractRedisStoreTest extends AbstractStoreTest
{
use ForwardCompatTestTrait;
use ExpiringStoreTestTrait;

/**
Expand Down
Expand Up @@ -21,8 +21,6 @@
*/
trait ExpiringStoreTestTrait
{
use ForwardCompatTestTrait;

/**
* Amount of microseconds used as a delay to test expiration. Should be
* small enough not to slow the test suite too much, and high enough not to
Expand Down
Expand Up @@ -191,8 +191,8 @@ public function testIsWritableReturnsFalseIfNoAdderNorRemoverExists()

public function testSetValueFailsIfAdderAndRemoverExistButValueIsNotTraversable()
{
$this->expectException('Symfony\Component\PropertyAccess\Exception\NoSuchPropertyException
expectedExceptionMessageRegExp /The property "axes" in class "Mock_PropertyAccessorCollectionTest_Car[^"]*" can be defined with the methods "addAxis()", "removeAxis()" but the new value must be an array or an instance of \Traversable, "string" given./');
$this->expectException('Symfony\Component\PropertyAccess\Exception\NoSuchPropertyException');
$this->expectExceptionMessage('Could not determine access type for property "axes" in class "Symfony\Component\PropertyAccess\Tests\PropertyAccessorCollectionTest_Car".');
$car = new PropertyAccessorCollectionTest_Car();

$this->propertyAccessor->setValue($car, 'axes', 'Not an array or Traversable');
Expand Down
Expand Up @@ -339,7 +339,7 @@ public function testDefaultRequirementOfVariableDisallowsNextSeparator()

public function testSchemeRequirement()
{
$this->expectException('Symfony\Component\Routing\Exception\ResourceNotFoundException');
$this->getExpectedException() ?: $this->expectException('Symfony\Component\Routing\Exception\ResourceNotFoundException');
$coll = new RouteCollection();
$coll->add('foo', new Route('/foo', [], [], [], '', ['https']));
$matcher = $this->getUrlMatcher($coll);
Expand Down
Expand Up @@ -12,19 +12,16 @@
namespace Symfony\Component\Security\Core\Tests\Resources;

use PHPUnit\Framework\TestCase;
use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;

class TranslationFilesTest extends TestCase
{
use ForwardCompatTestTrait;

/**
* @dataProvider provideTranslationFiles
*/
public function testTranslationFileIsValid($filePath)
{
if (class_exists('PHPUnit_Util_XML')) {
\PHPUnit\Util\XML::loadfile($filePath, false, false, true);
\PHPUnit_Util_XML::loadfile($filePath, false, false, true);
} else {
\PHPUnit\Util\XML::loadfile($filePath, false, false, true);
}
Expand Down
Expand Up @@ -12,19 +12,16 @@
namespace Symfony\Component\Validator\Tests\Resources;

use PHPUnit\Framework\TestCase;
use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;

class TranslationFilesTest extends TestCase
{
use ForwardCompatTestTrait;

/**
* @dataProvider provideTranslationFiles
*/
public function testTranslationFileIsValid($filePath)
{
if (class_exists('PHPUnit_Util_XML')) {
\PHPUnit\Util\XML::loadfile($filePath, false, false, true);
\PHPUnit_Util_XML::loadfile($filePath, false, false, true);
} else {
\PHPUnit\Util\XML::loadfile($filePath, false, false, true);
}
Expand Down

0 comments on commit a22a9c4

Please sign in to comment.