commit
f35a0d202f
26
appveyor.yml
26
appveyor.yml
|
@ -13,7 +13,7 @@ init:
|
||||||
- SET SYMFONY_DEPRECATIONS_HELPER=strict
|
- SET SYMFONY_DEPRECATIONS_HELPER=strict
|
||||||
- SET PHP=1
|
- SET PHP=1
|
||||||
- SET ANSICON=121x90 (121x90)
|
- SET ANSICON=121x90 (121x90)
|
||||||
- SET PHP_INI_MATRIX=php.ini-min-ext php.ini-max-ext
|
- SET PHP_INI_MATRIX=php.ini-min php.ini-max
|
||||||
|
|
||||||
install:
|
install:
|
||||||
- IF EXIST c:\php (SET PHP=0) ELSE (mkdir c:\php)
|
- IF EXIST c:\php (SET PHP=0) ELSE (mkdir c:\php)
|
||||||
|
@ -31,19 +31,19 @@ install:
|
||||||
- IF %PHP%==1 7z x php_memcache-3.0.8-5.3-nts-vc9-x86.zip -y > 7z.log
|
- IF %PHP%==1 7z x php_memcache-3.0.8-5.3-nts-vc9-x86.zip -y > 7z.log
|
||||||
- IF %PHP%==1 cd ..
|
- IF %PHP%==1 cd ..
|
||||||
- IF %PHP%==1 echo @php %%~dp0composer.phar %%* > composer.bat
|
- IF %PHP%==1 echo @php %%~dp0composer.phar %%* > composer.bat
|
||||||
- IF %PHP%==1 copy /Y php.ini-development php.ini-min-ext
|
- IF %PHP%==1 copy /Y php.ini-development php.ini-min
|
||||||
- IF %PHP%==1 echo date.timezone="UTC" >> php.ini-min-ext
|
- IF %PHP%==1 echo date.timezone="UTC" >> php.ini-min
|
||||||
- IF %PHP%==1 echo extension_dir=ext >> php.ini-min-ext
|
- IF %PHP%==1 echo extension_dir=ext >> php.ini-min
|
||||||
- IF %PHP%==1 echo extension=php_openssl.dll >> php.ini-min-ext
|
- IF %PHP%==1 echo extension=php_openssl.dll >> php.ini-min
|
||||||
- IF %PHP%==1 copy /Y php.ini-min-ext php.ini-max-ext
|
- IF %PHP%==1 copy /Y php.ini-min php.ini-max
|
||||||
- IF %PHP%==1 echo extension=php_apc.dll >> php.ini-max-ext
|
- IF %PHP%==1 echo extension=php_apc.dll >> php.ini-max
|
||||||
- IF %PHP%==1 echo extension=php_intl.dll >> php.ini-max-ext
|
- IF %PHP%==1 echo extension=php_intl.dll >> php.ini-max
|
||||||
- IF %PHP%==1 echo extension=php_mbstring.dll >> php.ini-max-ext
|
- IF %PHP%==1 echo extension=php_mbstring.dll >> php.ini-max
|
||||||
- IF %PHP%==1 echo extension=php_fileinfo.dll >> php.ini-max-ext
|
- IF %PHP%==1 echo extension=php_fileinfo.dll >> php.ini-max
|
||||||
- IF %PHP%==1 echo extension=php_pdo_sqlite.dll >> php.ini-max-ext
|
- IF %PHP%==1 echo extension=php_pdo_sqlite.dll >> php.ini-max
|
||||||
- IF %PHP%==1 echo extension=php_ldap.dll >> php.ini-max-ext
|
- IF %PHP%==1 echo extension=php_ldap.dll >> php.ini-max
|
||||||
- appveyor DownloadFile https://getcomposer.org/composer.phar
|
- appveyor DownloadFile https://getcomposer.org/composer.phar
|
||||||
- copy /Y php.ini-max-ext php.ini
|
- copy /Y php.ini-max php.ini
|
||||||
- cd c:\projects\symfony
|
- cd c:\projects\symfony
|
||||||
- php phpunit install
|
- php phpunit install
|
||||||
- IF %APPVEYOR_REPO_BRANCH%==master (SET COMPOSER_ROOT_VERSION=dev-master) ELSE (SET COMPOSER_ROOT_VERSION=%APPVEYOR_REPO_BRANCH%.x-dev)
|
- IF %APPVEYOR_REPO_BRANCH%==master (SET COMPOSER_ROOT_VERSION=dev-master) ELSE (SET COMPOSER_ROOT_VERSION=%APPVEYOR_REPO_BRANCH%.x-dev)
|
||||||
|
|
4
phpunit
4
phpunit
|
@ -24,10 +24,6 @@ if (!file_exists($COMPOSER = __DIR__.'/composer.phar')) {
|
||||||
$PHP = ProcessUtils::escapeArgument($PHP);
|
$PHP = ProcessUtils::escapeArgument($PHP);
|
||||||
$COMPOSER = $PHP.' '.ProcessUtils::escapeArgument($COMPOSER);
|
$COMPOSER = $PHP.' '.ProcessUtils::escapeArgument($COMPOSER);
|
||||||
|
|
||||||
if (!(isset($argv[1]) && 'install' === $argv[1]) && !file_exists(__DIR__.'/vendor')) {
|
|
||||||
passthru("$COMPOSER update --no-progress --ansi");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!file_exists("$PHPUNIT_DIR/phpunit-$PHPUNIT_VERSION/phpunit")) {
|
if (!file_exists("$PHPUNIT_DIR/phpunit-$PHPUNIT_VERSION/phpunit")) {
|
||||||
// Build a standalone phpunit without symfony/yaml
|
// Build a standalone phpunit without symfony/yaml
|
||||||
|
|
||||||
|
|
|
@ -91,12 +91,16 @@ class ClassLoader
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (isset($this->prefixes[$prefix])) {
|
if (isset($this->prefixes[$prefix])) {
|
||||||
$this->prefixes[$prefix] = array_merge(
|
if (is_array($paths)) {
|
||||||
$this->prefixes[$prefix],
|
$this->prefixes[$prefix] = array_unique(array_merge(
|
||||||
(array) $paths
|
$this->prefixes[$prefix],
|
||||||
);
|
$paths
|
||||||
|
));
|
||||||
|
} elseif (!in_array($paths, $this->prefixes[$prefix])) {
|
||||||
|
$this->prefixes[$prefix][] = $paths;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$this->prefixes[$prefix] = (array) $paths;
|
$this->prefixes[$prefix] = array_unique((array) $paths);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -76,14 +76,36 @@ class ClassLoaderTest extends \PHPUnit_Framework_TestCase
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testAddPrefix()
|
public function testAddPrefixSingle()
|
||||||
{
|
{
|
||||||
$loader = new ClassLoader();
|
$loader = new ClassLoader();
|
||||||
$loader->addPrefix('Foo', __DIR__.DIRECTORY_SEPARATOR.'Fixtures');
|
$loader->addPrefix('Foo', __DIR__.DIRECTORY_SEPARATOR.'Fixtures');
|
||||||
$loader->addPrefix('Foo', __DIR__.DIRECTORY_SEPARATOR.'Fixtures');
|
$loader->addPrefix('Foo', __DIR__.DIRECTORY_SEPARATOR.'Fixtures');
|
||||||
$prefixes = $loader->getPrefixes();
|
$prefixes = $loader->getPrefixes();
|
||||||
$this->assertArrayHasKey('Foo', $prefixes);
|
$this->assertArrayHasKey('Foo', $prefixes);
|
||||||
|
$this->assertCount(1, $prefixes['Foo']);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testAddPrefixesSingle()
|
||||||
|
{
|
||||||
|
$loader = new ClassLoader();
|
||||||
|
$loader->addPrefixes(array('Foo' => array('foo', 'foo')));
|
||||||
|
$loader->addPrefixes(array('Foo' => array('foo')));
|
||||||
|
$prefixes = $loader->getPrefixes();
|
||||||
|
$this->assertArrayHasKey('Foo', $prefixes);
|
||||||
|
$this->assertCount(1, $prefixes['Foo'], print_r($prefixes, true));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testAddPrefixMulti()
|
||||||
|
{
|
||||||
|
$loader = new ClassLoader();
|
||||||
|
$loader->addPrefix('Foo', 'foo');
|
||||||
|
$loader->addPrefix('Foo', 'bar');
|
||||||
|
$prefixes = $loader->getPrefixes();
|
||||||
|
$this->assertArrayHasKey('Foo', $prefixes);
|
||||||
$this->assertCount(2, $prefixes['Foo']);
|
$this->assertCount(2, $prefixes['Foo']);
|
||||||
|
$this->assertContains('foo', $prefixes['Foo']);
|
||||||
|
$this->assertContains('bar', $prefixes['Foo']);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testUseIncludePath()
|
public function testUseIncludePath()
|
||||||
|
|
|
@ -417,7 +417,7 @@ class Filesystem
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (is_link($file)) {
|
if (is_link($file)) {
|
||||||
$this->symlink($file->getRealPath(), $target);
|
$this->symlink($file->getLinkTarget(), $target);
|
||||||
} elseif (is_dir($file)) {
|
} elseif (is_dir($file)) {
|
||||||
$this->mkdir($target);
|
$this->mkdir($target);
|
||||||
} elseif (is_file($file)) {
|
} elseif (is_file($file)) {
|
||||||
|
|
|
@ -915,7 +915,7 @@ class FilesystemTest extends FilesystemTestCase
|
||||||
$this->assertTrue(is_dir($targetPath));
|
$this->assertTrue(is_dir($targetPath));
|
||||||
$this->assertFileEquals($sourcePath.'/nested/file1.txt', $targetPath.DIRECTORY_SEPARATOR.'link1/file1.txt');
|
$this->assertFileEquals($sourcePath.'/nested/file1.txt', $targetPath.DIRECTORY_SEPARATOR.'link1/file1.txt');
|
||||||
$this->assertTrue(is_link($targetPath.DIRECTORY_SEPARATOR.'link1'));
|
$this->assertTrue(is_link($targetPath.DIRECTORY_SEPARATOR.'link1'));
|
||||||
$this->assertEquals($sourcePath.'nested', readlink($targetPath.DIRECTORY_SEPARATOR.'link1'));
|
$this->assertEquals('nested', readlink($targetPath.DIRECTORY_SEPARATOR.'link1'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -46,7 +46,7 @@ class UrlValidator extends ConstraintValidator
|
||||||
throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\Url');
|
throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\Url');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (null === $value || '' === $value) {
|
if (null === $value) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,6 +55,10 @@ class UrlValidator extends ConstraintValidator
|
||||||
}
|
}
|
||||||
|
|
||||||
$value = (string) $value;
|
$value = (string) $value;
|
||||||
|
if ('' === $value) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$pattern = sprintf(static::PATTERN, implode('|', $constraint->protocols));
|
$pattern = sprintf(static::PATTERN, implode('|', $constraint->protocols));
|
||||||
|
|
||||||
if (!preg_match($pattern, $value)) {
|
if (!preg_match($pattern, $value)) {
|
||||||
|
|
|
@ -41,6 +41,13 @@ class UrlValidatorTest extends AbstractConstraintValidatorTest
|
||||||
$this->assertNoViolation();
|
$this->assertNoViolation();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testEmptyStringFromObjectIsValid()
|
||||||
|
{
|
||||||
|
$this->validator->validate(new EmailProvider(), new Url());
|
||||||
|
|
||||||
|
$this->assertNoViolation();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @expectedException \Symfony\Component\Validator\Exception\UnexpectedTypeException
|
* @expectedException \Symfony\Component\Validator\Exception\UnexpectedTypeException
|
||||||
*/
|
*/
|
||||||
|
@ -178,3 +185,11 @@ class UrlValidatorTest extends AbstractConstraintValidatorTest
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class EmailProvider
|
||||||
|
{
|
||||||
|
public function __toString()
|
||||||
|
{
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Reference in New Issue