Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f35a0d2

Browse files
Merge branch '2.7' into 2.8
Conflicts: appveyor.yml
2 parents 508ff48 + 481f39d commit f35a0d2

File tree

8 files changed

+67
-26
lines changed

8 files changed

+67
-26
lines changed

appveyor.yml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ init:
1313
- SET SYMFONY_DEPRECATIONS_HELPER=strict
1414
- SET PHP=1
1515
- SET ANSICON=121x90 (121x90)
16-
- SET PHP_INI_MATRIX=php.ini-min-ext php.ini-max-ext
16+
- SET PHP_INI_MATRIX=php.ini-min php.ini-max
1717

1818
install:
1919
- IF EXIST c:\php (SET PHP=0) ELSE (mkdir c:\php)
@@ -31,19 +31,19 @@ install:
3131
- IF %PHP%==1 7z x php_memcache-3.0.8-5.3-nts-vc9-x86.zip -y > 7z.log
3232
- IF %PHP%==1 cd ..
3333
- IF %PHP%==1 echo @php %%~dp0composer.phar %%* > composer.bat
34-
- IF %PHP%==1 copy /Y php.ini-development php.ini-min-ext
35-
- IF %PHP%==1 echo date.timezone="UTC" >> php.ini-min-ext
36-
- IF %PHP%==1 echo extension_dir=ext >> php.ini-min-ext
37-
- IF %PHP%==1 echo extension=php_openssl.dll >> php.ini-min-ext
38-
- IF %PHP%==1 copy /Y php.ini-min-ext php.ini-max-ext
39-
- IF %PHP%==1 echo extension=php_apc.dll >> php.ini-max-ext
40-
- IF %PHP%==1 echo extension=php_intl.dll >> php.ini-max-ext
41-
- IF %PHP%==1 echo extension=php_mbstring.dll >> php.ini-max-ext
42-
- IF %PHP%==1 echo extension=php_fileinfo.dll >> php.ini-max-ext
43-
- IF %PHP%==1 echo extension=php_pdo_sqlite.dll >> php.ini-max-ext
44-
- IF %PHP%==1 echo extension=php_ldap.dll >> php.ini-max-ext
34+
- IF %PHP%==1 copy /Y php.ini-development php.ini-min
35+
- IF %PHP%==1 echo date.timezone="UTC" >> php.ini-min
36+
- IF %PHP%==1 echo extension_dir=ext >> php.ini-min
37+
- IF %PHP%==1 echo extension=php_openssl.dll >> php.ini-min
38+
- IF %PHP%==1 copy /Y php.ini-min php.ini-max
39+
- IF %PHP%==1 echo extension=php_apc.dll >> php.ini-max
40+
- IF %PHP%==1 echo extension=php_intl.dll >> php.ini-max
41+
- IF %PHP%==1 echo extension=php_mbstring.dll >> php.ini-max
42+
- IF %PHP%==1 echo extension=php_fileinfo.dll >> php.ini-max
43+
- IF %PHP%==1 echo extension=php_pdo_sqlite.dll >> php.ini-max
44+
- IF %PHP%==1 echo extension=php_ldap.dll >> php.ini-max
4545
- appveyor DownloadFile https://getcomposer.org/composer.phar
46-
- copy /Y php.ini-max-ext php.ini
46+
- copy /Y php.ini-max php.ini
4747
- cd c:\projects\symfony
4848
- php phpunit install
4949
- IF %APPVEYOR_REPO_BRANCH%==master (SET COMPOSER_ROOT_VERSION=dev-master) ELSE (SET COMPOSER_ROOT_VERSION=%APPVEYOR_REPO_BRANCH%.x-dev)

phpunit

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,6 @@ if (!file_exists($COMPOSER = __DIR__.'/composer.phar')) {
2424
$PHP = ProcessUtils::escapeArgument($PHP);
2525
$COMPOSER = $PHP.' '.ProcessUtils::escapeArgument($COMPOSER);
2626

27-
if (!(isset($argv[1]) && 'install' === $argv[1]) && !file_exists(__DIR__.'/vendor')) {
28-
passthru("$COMPOSER update --no-progress --ansi");
29-
}
30-
3127
if (!file_exists("$PHPUNIT_DIR/phpunit-$PHPUNIT_VERSION/phpunit")) {
3228
// Build a standalone phpunit without symfony/yaml
3329

src/Symfony/Component/ClassLoader/ClassLoader.php

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,16 @@ public function addPrefix($prefix, $paths)
9191
return;
9292
}
9393
if (isset($this->prefixes[$prefix])) {
94-
$this->prefixes[$prefix] = array_merge(
95-
$this->prefixes[$prefix],
96-
(array) $paths
97-
);
94+
if (is_array($paths)) {
95+
$this->prefixes[$prefix] = array_unique(array_merge(
96+
$this->prefixes[$prefix],
97+
$paths
98+
));
99+
} elseif (!in_array($paths, $this->prefixes[$prefix])) {
100+
$this->prefixes[$prefix][] = $paths;
101+
}
98102
} else {
99-
$this->prefixes[$prefix] = (array) $paths;
103+
$this->prefixes[$prefix] = array_unique((array) $paths);
100104
}
101105
}
102106

src/Symfony/Component/ClassLoader/Tests/ClassLoaderTest.php

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,36 @@ public function getLoadNonexistentClassTests()
7676
);
7777
}
7878

79-
public function testAddPrefix()
79+
public function testAddPrefixSingle()
8080
{
8181
$loader = new ClassLoader();
8282
$loader->addPrefix('Foo', __DIR__.DIRECTORY_SEPARATOR.'Fixtures');
8383
$loader->addPrefix('Foo', __DIR__.DIRECTORY_SEPARATOR.'Fixtures');
8484
$prefixes = $loader->getPrefixes();
8585
$this->assertArrayHasKey('Foo', $prefixes);
86+
$this->assertCount(1, $prefixes['Foo']);
87+
}
88+
89+
public function testAddPrefixesSingle()
90+
{
91+
$loader = new ClassLoader();
92+
$loader->addPrefixes(array('Foo' => array('foo', 'foo')));
93+
$loader->addPrefixes(array('Foo' => array('foo')));
94+
$prefixes = $loader->getPrefixes();
95+
$this->assertArrayHasKey('Foo', $prefixes);
96+
$this->assertCount(1, $prefixes['Foo'], print_r($prefixes, true));
97+
}
98+
99+
public function testAddPrefixMulti()
100+
{
101+
$loader = new ClassLoader();
102+
$loader->addPrefix('Foo', 'foo');
103+
$loader->addPrefix('Foo', 'bar');
104+
$prefixes = $loader->getPrefixes();
105+
$this->assertArrayHasKey('Foo', $prefixes);
86106
$this->assertCount(2, $prefixes['Foo']);
107+
$this->assertContains('foo', $prefixes['Foo']);
108+
$this->assertContains('bar', $prefixes['Foo']);
87109
}
88110

89111
public function testUseIncludePath()

src/Symfony/Component/Filesystem/Filesystem.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ public function mirror($originDir, $targetDir, \Traversable $iterator = null, $o
417417
}
418418
} else {
419419
if (is_link($file)) {
420-
$this->symlink($file->getRealPath(), $target);
420+
$this->symlink($file->getLinkTarget(), $target);
421421
} elseif (is_dir($file)) {
422422
$this->mkdir($target);
423423
} elseif (is_file($file)) {

src/Symfony/Component/Filesystem/Tests/FilesystemTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -915,7 +915,7 @@ public function testMirrorCopiesRelativeLinkedContents()
915915
$this->assertTrue(is_dir($targetPath));
916916
$this->assertFileEquals($sourcePath.'/nested/file1.txt', $targetPath.DIRECTORY_SEPARATOR.'link1/file1.txt');
917917
$this->assertTrue(is_link($targetPath.DIRECTORY_SEPARATOR.'link1'));
918-
$this->assertEquals($sourcePath.'nested', readlink($targetPath.DIRECTORY_SEPARATOR.'link1'));
918+
$this->assertEquals('nested', readlink($targetPath.DIRECTORY_SEPARATOR.'link1'));
919919
}
920920

921921
/**

src/Symfony/Component/Validator/Constraints/UrlValidator.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public function validate($value, Constraint $constraint)
4646
throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\Url');
4747
}
4848

49-
if (null === $value || '' === $value) {
49+
if (null === $value) {
5050
return;
5151
}
5252

@@ -55,6 +55,10 @@ public function validate($value, Constraint $constraint)
5555
}
5656

5757
$value = (string) $value;
58+
if ('' === $value) {
59+
return;
60+
}
61+
5862
$pattern = sprintf(static::PATTERN, implode('|', $constraint->protocols));
5963

6064
if (!preg_match($pattern, $value)) {

src/Symfony/Component/Validator/Tests/Constraints/UrlValidatorTest.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,13 @@ public function testEmptyStringIsValid()
4141
$this->assertNoViolation();
4242
}
4343

44+
public function testEmptyStringFromObjectIsValid()
45+
{
46+
$this->validator->validate(new EmailProvider(), new Url());
47+
48+
$this->assertNoViolation();
49+
}
50+
4451
/**
4552
* @expectedException \Symfony\Component\Validator\Exception\UnexpectedTypeException
4653
*/
@@ -178,3 +185,11 @@ public function getValidCustomUrls()
178185
);
179186
}
180187
}
188+
189+
class EmailProvider
190+
{
191+
public function __toString()
192+
{
193+
return '';
194+
}
195+
}

0 commit comments

Comments
 (0)