[Validator] Improved tests to use the IntlTestHelper class
This commit is contained in:
parent
9d9c38996c
commit
03b78b0e00
@ -11,17 +11,18 @@
|
||||
|
||||
namespace Symfony\Component\Validator\Tests\Constraints;
|
||||
|
||||
use Symfony\Component\Intl\Util\IntlTestHelper;
|
||||
use Symfony\Component\Validator\Constraints\Country;
|
||||
use Symfony\Component\Validator\Constraints\CountryValidator;
|
||||
|
||||
class CountryValidatorTest extends LocalizedTestCase
|
||||
class CountryValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
protected $context;
|
||||
protected $validator;
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
IntlTestHelper::requireIntl($this);
|
||||
|
||||
$this->context = $this->getMock('Symfony\Component\Validator\ExecutionContext', array(), array(), '', false);
|
||||
$this->validator = new CountryValidator();
|
||||
|
@ -11,17 +11,18 @@
|
||||
|
||||
namespace Symfony\Component\Validator\Tests\Constraints;
|
||||
|
||||
use Symfony\Component\Intl\Util\IntlTestHelper;
|
||||
use Symfony\Component\Validator\Constraints\Language;
|
||||
use Symfony\Component\Validator\Constraints\LanguageValidator;
|
||||
|
||||
class LanguageValidatorTest extends LocalizedTestCase
|
||||
class LanguageValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
protected $context;
|
||||
protected $validator;
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
IntlTestHelper::requireIntl($this);
|
||||
|
||||
$this->context = $this->getMock('Symfony\Component\Validator\ExecutionContext', array(), array(), '', false);
|
||||
$this->validator = new LanguageValidator();
|
||||
|
@ -11,17 +11,18 @@
|
||||
|
||||
namespace Symfony\Component\Validator\Tests\Constraints;
|
||||
|
||||
use Symfony\Component\Intl\Util\IntlTestHelper;
|
||||
use Symfony\Component\Validator\Constraints\Locale;
|
||||
use Symfony\Component\Validator\Constraints\LocaleValidator;
|
||||
|
||||
class LocaleValidatorTest extends LocalizedTestCase
|
||||
class LocaleValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
protected $context;
|
||||
protected $validator;
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
IntlTestHelper::requireIntl($this);
|
||||
|
||||
$this->context = $this->getMock('Symfony\Component\Validator\ExecutionContext', array(), array(), '', false);
|
||||
$this->validator = new LocaleValidator();
|
||||
|
@ -1,34 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Validator\Tests\Constraints;
|
||||
|
||||
use Symfony\Component\Intl\Intl;
|
||||
|
||||
abstract class LocalizedTestCase extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
protected function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
if (!class_exists('Symfony\Component\Intl\Intl')) {
|
||||
$this->markTestSkipped('The "Intl" component is not available');
|
||||
}
|
||||
|
||||
if (!Intl::isExtensionLoaded()) {
|
||||
$this->markTestSkipped('The "intl" extension is not available');
|
||||
}
|
||||
|
||||
Intl::setDataSource(Intl::STUB);
|
||||
|
||||
\Locale::setDefault('en');
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user