Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 2abbb8a

Browse filesBrowse files
Merge branch '2.8'
* 2.8: Fix undefined array $server Fix call to undefined function json_last_error_message Fix bug in windows detection [ProxyManager] Tmp fix composer reqs issue in ZF Fix PropertyInfo extractor namespace in framework bundle Add missing exclusions from phpunit.xml.dist [Serializer] ObjectNormalizer: don't serialize static methods and props [Form] Enhance some FormRegistry deprecation messages [Validator] [sl] BIC (SWIFT-BIC) validation constraint [WebProfilerBundle] correct typo in show stack trace link bumped Symfony version to 2.8.0 updated VERSION for 2.8.0-BETA1 updated CHANGELOG for 2.8.0-BETA1 Fix the server variables in the router_*.php files [Validator] Allow an empty path with a non empty fragment or a query The following change adds support for Armenian pluralization. [2.3][Process] fix Proccess run with pts enabled Conflicts: src/Symfony/Bridge/ProxyManager/composer.json src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/FormPass.php src/Symfony/Component/Form/FormRegistry.php
2 parents 9835236 + ecdd681 commit 2abbb8a
Copy full SHA for 2abbb8a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Dismiss banner

46 files changed

+141
-34
lines changed

‎composer.json

Copy file name to clipboardExpand all lines: composer.json
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@
8080
"doctrine/orm": "~2.4,>=2.4.5",
8181
"doctrine/doctrine-bundle": "~1.4",
8282
"monolog/monolog": "~1.11",
83+
"zendframework/zend-stdlib": "~2.5",
8384
"ocramius/proxy-manager": "~0.4|~1.0",
8485
"egulias/email-validator": "~1.2",
8586
"symfony/security-acl": "~2.8|~3.0",

‎phpunit.xml.dist

Copy file name to clipboardExpand all lines: phpunit.xml.dist
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@
4040
<directory>./src/Symfony/Bundle/*/Resources</directory>
4141
<directory>./src/Symfony/Component/*/Resources</directory>
4242
<directory>./src/Symfony/Component/*/*/Resources</directory>
43+
<directory>./src/Symfony/Bridge/*/vendor</directory>
44+
<directory>./src/Symfony/Bundle/*/vendor</directory>
45+
<directory>./src/Symfony/Component/*/vendor</directory>
46+
<directory>./src/Symfony/Component/*/*/vendor</directory>
4347
</exclude>
4448
</whitelist>
4549
</filter>

‎src/Symfony/Bridge/Doctrine/phpunit.xml.dist

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Doctrine/phpunit.xml.dist
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
<exclude>
2323
<directory>./Resources</directory>
2424
<directory>./Tests</directory>
25+
<directory>./vendor</directory>
2526
</exclude>
2627
</whitelist>
2728
</filter>

‎src/Symfony/Bridge/Monolog/phpunit.xml.dist

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Monolog/phpunit.xml.dist
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
<exclude>
2323
<directory>./Resources</directory>
2424
<directory>./Tests</directory>
25+
<directory>./vendor</directory>
2526
</exclude>
2627
</whitelist>
2728
</filter>

‎src/Symfony/Bridge/ProxyManager/composer.json

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/ProxyManager/composer.json
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"require": {
1919
"php": ">=5.5.9",
2020
"symfony/dependency-injection": "~2.8|~3.0",
21+
"zendframework/zend-stdlib": "~2.5",
2122
"ocramius/proxy-manager": "~0.4|~1.0"
2223
},
2324
"require-dev": {

‎src/Symfony/Bundle/DebugBundle/phpunit.xml.dist

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/DebugBundle/phpunit.xml.dist
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
<whitelist>
2121
<directory>./</directory>
2222
<exclude>
23-
<directory>./Tests</directory>
2423
<directory>./Resources</directory>
24+
<directory>./Tests</directory>
2525
<directory>./vendor</directory>
2626
</exclude>
2727
</whitelist>

‎src/Symfony/Bundle/FrameworkBundle/Resources/config/property_info.xml

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Resources/config/property_info.xml
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
</service>
1414

1515
<!-- Extractor -->
16-
<service id="property_info.reflection_extractor" class="Symfony\Component\PropertyInfo\ReflectionExtractor" public="false">
16+
<service id="property_info.reflection_extractor" class="Symfony\Component\PropertyInfo\Extractor\ReflectionExtractor" public="false">
1717
<tag name="property_info.list_extractor" priority="-1000" />
1818
<tag name="property_info.type_extractor" priority="-1000" />
1919
<tag name="property_info.access_extractor" priority="-1000" />

‎src/Symfony/Bundle/FrameworkBundle/Resources/config/router_dev.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Resources/config/router_dev.php
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@
3333
$_SERVER = array_merge($_SERVER, $_ENV);
3434
$_SERVER['SCRIPT_FILENAME'] = $_SERVER['DOCUMENT_ROOT'].DIRECTORY_SEPARATOR.'app_dev.php';
3535

36+
// Since we are rewriting to app_dev.php, adjust SCRIPT_NAME and PHP_SELF accordingly
37+
$_SERVER['SCRIPT_NAME'] = DIRECTORY_SEPARATOR.'app_dev.php';
38+
$_SERVER['PHP_SELF'] = DIRECTORY_SEPARATOR.'app_dev.php';
39+
3640
require 'app_dev.php';
3741

3842
error_log(sprintf('%s:%d [%d]: %s', $_SERVER['REMOTE_ADDR'], $_SERVER['REMOTE_PORT'], http_response_code(), $_SERVER['REQUEST_URI']), 4);

‎src/Symfony/Bundle/FrameworkBundle/Resources/config/router_prod.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Resources/config/router_prod.php
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@
3333
$_SERVER = array_merge($_SERVER, $_ENV);
3434
$_SERVER['SCRIPT_FILENAME'] = $_SERVER['DOCUMENT_ROOT'].DIRECTORY_SEPARATOR.'app.php';
3535

36+
// Since we are rewriting to app.php, adjust SCRIPT_NAME and PHP_SELF accordingly
37+
$_SERVER['SCRIPT_NAME'] = DIRECTORY_SEPARATOR.'app.php';
38+
$_SERVER['PHP_SELF'] = DIRECTORY_SEPARATOR.'app.php';
39+
3640
require 'app.php';
3741

3842
error_log(sprintf('%s:%d [%d]: %s', $_SERVER['REMOTE_ADDR'], $_SERVER['REMOTE_PORT'], http_response_code(), $_SERVER['REQUEST_URI']), 4);

‎src/Symfony/Bundle/FrameworkBundle/phpunit.xml.dist

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/phpunit.xml.dist
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020
<whitelist>
2121
<directory>./</directory>
2222
<exclude>
23-
<directory>./vendor</directory>
2423
<directory>./Resources</directory>
2524
<directory>./Tests</directory>
25+
<directory>./vendor</directory>
2626
</exclude>
2727
</whitelist>
2828
</filter>

‎src/Symfony/Bundle/SecurityBundle/phpunit.xml.dist

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/SecurityBundle/phpunit.xml.dist
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
<whitelist>
2121
<directory>./</directory>
2222
<exclude>
23-
<directory>./Tests</directory>
2423
<directory>./Resources</directory>
24+
<directory>./Tests</directory>
2525
<directory>./vendor</directory>
2626
</exclude>
2727
</whitelist>

‎src/Symfony/Bundle/TwigBundle/phpunit.xml.dist

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/TwigBundle/phpunit.xml.dist
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
<whitelist>
2121
<directory>./</directory>
2222
<exclude>
23-
<directory>./Tests</directory>
2423
<directory>./Resources</directory>
24+
<directory>./Tests</directory>
2525
<directory>./vendor</directory>
2626
</exclude>
2727
</whitelist>

‎src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/logger.html.twig

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/logger.html.twig
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@
162162
{% endif %}
163163

164164
{% if stack %}
165-
<button class="btn-link text-small sf-toggle" data-toggle-selector="#{{ id }}" data-toggle-alt-content="Hide stack trace">Show strack trace</button>
165+
<button class="btn-link text-small sf-toggle" data-toggle-selector="#{{ id }}" data-toggle-alt-content="Hide stack trace">Show stack trace</button>
166166
{% endif %}
167167

168168
{% for index, call in stack if index > 1 %}

‎src/Symfony/Bundle/WebProfilerBundle/phpunit.xml.dist

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/WebProfilerBundle/phpunit.xml.dist
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
<whitelist>
2121
<directory>./</directory>
2222
<exclude>
23-
<directory>./Tests</directory>
2423
<directory>./Resources</directory>
24+
<directory>./Tests</directory>
2525
<directory>./vendor</directory>
2626
</exclude>
2727
</whitelist>

‎src/Symfony/Component/Asset/phpunit.xml.dist

Copy file name to clipboardExpand all lines: src/Symfony/Component/Asset/phpunit.xml.dist
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
<whitelist>
2121
<directory>./</directory>
2222
<exclude>
23-
<directory>./vendor</directory>
2423
<directory>./Tests</directory>
24+
<directory>./vendor</directory>
2525
</exclude>
2626
</whitelist>
2727
</filter>

‎src/Symfony/Component/Console/Style/SymfonyStyle.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Console/Style/SymfonyStyle.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ public function createProgressBar($max = 0)
303303
{
304304
$progressBar = parent::createProgressBar($max);
305305

306-
if ('\\' === DIRECTORY_SEPARATOR) {
306+
if ('\\' !== DIRECTORY_SEPARATOR) {
307307
$progressBar->setEmptyBarCharacter(''); // light shade character \u2591
308308
$progressBar->setProgressCharacter('');
309309
$progressBar->setBarCharacter(''); // dark shade character \u2593

‎src/Symfony/Component/Filesystem/phpunit.xml.dist

Copy file name to clipboardExpand all lines: src/Symfony/Component/Filesystem/phpunit.xml.dist
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
<directory>./</directory>
2222
<exclude>
2323
<directory>./Tests</directory>
24+
<directory>./vendor</directory>
2425
</exclude>
2526
</whitelist>
2627
</filter>

‎src/Symfony/Component/Form/phpunit.xml.dist

Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/phpunit.xml.dist
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
<whitelist>
2121
<directory>./</directory>
2222
<exclude>
23+
<directory>./Resources</directory>
2324
<directory>./Tests</directory>
2425
<directory>./vendor</directory>
2526
</exclude>

‎src/Symfony/Component/HttpFoundation/Tests/RequestTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpFoundation/Tests/RequestTest.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,7 @@ public function testGetUserInfo()
590590
{
591591
$request = new Request();
592592

593-
$server['PHP_AUTH_USER'] = 'fabien';
593+
$server = array('PHP_AUTH_USER' => 'fabien');
594594
$request->initialize(array(), array(), array(), array(), array(), $server);
595595
$this->assertEquals('fabien', $request->getUserInfo());
596596

‎src/Symfony/Component/Intl/phpunit.xml.dist

Copy file name to clipboardExpand all lines: src/Symfony/Component/Intl/phpunit.xml.dist
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
<whitelist>
2727
<directory>./</directory>
2828
<exclude>
29+
<directory>./Resources</directory>
2930
<directory>./Tests</directory>
3031
<directory>./vendor</directory>
3132
</exclude>

‎src/Symfony/Component/OptionsResolver/phpunit.xml.dist

Copy file name to clipboardExpand all lines: src/Symfony/Component/OptionsResolver/phpunit.xml.dist
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
<exclude>
2323
<directory>./Resources</directory>
2424
<directory>./Tests</directory>
25+
<directory>./vendor</directory>
2526
</exclude>
2627
</whitelist>
2728
</filter>

‎src/Symfony/Component/Process/Process.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Process/Process.php
+12Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,8 +280,20 @@ public function start(callable $callback = null)
280280
}
281281
}
282282

283+
$ptsWorkaround = null;
284+
285+
if (!$this->useFileHandles && $this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
286+
// Workaround for the bug, when PTS functionality is enabled.
287+
// @see : https://bugs.php.net/69442
288+
$ptsWorkaround = fopen('php://fd/0', 'r');
289+
}
290+
283291
$this->process = proc_open($commandline, $descriptors, $this->processPipes->pipes, $this->cwd, $this->env, $this->options);
284292

293+
if ($ptsWorkaround) {
294+
fclose($ptsWorkaround);
295+
}
296+
285297
if (!is_resource($this->process)) {
286298
throw new RuntimeException('Unable to launch a new process.');
287299
}

‎src/Symfony/Component/Process/phpunit.xml.dist

Copy file name to clipboardExpand all lines: src/Symfony/Component/Process/phpunit.xml.dist
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
<directory>./</directory>
2222
<exclude>
2323
<directory>./Tests</directory>
24+
<directory>./vendor</directory>
2425
</exclude>
2526
</whitelist>
2627
</filter>

‎src/Symfony/Component/PropertyAccess/phpunit.xml.dist

Copy file name to clipboardExpand all lines: src/Symfony/Component/PropertyAccess/phpunit.xml.dist
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
<exclude>
2323
<directory>./Resources</directory>
2424
<directory>./Tests</directory>
25+
<directory>./vendor</directory>
2526
</exclude>
2627
</whitelist>
2728
</filter>

‎src/Symfony/Component/Routing/phpunit.xml.dist

Copy file name to clipboardExpand all lines: src/Symfony/Component/Routing/phpunit.xml.dist
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
<whitelist>
2121
<directory>./</directory>
2222
<exclude>
23-
<directory>./vendor</directory>
2423
<directory>./Tests</directory>
24+
<directory>./vendor</directory>
2525
</exclude>
2626
</whitelist>
2727
</filter>

‎src/Symfony/Component/Security/Core/phpunit.xml.dist

Copy file name to clipboardExpand all lines: src/Symfony/Component/Security/Core/phpunit.xml.dist
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@
2525
<whitelist>
2626
<directory>./</directory>
2727
<exclude>
28-
<directory>./vendor</directory>
28+
<directory>./Resources</directory>
2929
<directory>./Tests</directory>
30+
<directory>./vendor</directory>
3031
</exclude>
3132
</whitelist>
3233
</filter>

‎src/Symfony/Component/Security/Csrf/phpunit.xml.dist

Copy file name to clipboardExpand all lines: src/Symfony/Component/Security/Csrf/phpunit.xml.dist
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
<whitelist>
2626
<directory>./</directory>
2727
<exclude>
28-
<directory>./vendor</directory>
2928
<directory>./Tests</directory>
29+
<directory>./vendor</directory>
3030
</exclude>
3131
</whitelist>
3232
</filter>

‎src/Symfony/Component/Security/Guard/phpunit.xml.dist

Copy file name to clipboardExpand all lines: src/Symfony/Component/Security/Guard/phpunit.xml.dist
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@
2525
<whitelist>
2626
<directory>./</directory>
2727
<exclude>
28-
<directory>./vendor</directory>
28+
<directory>./Resources</directory>
2929
<directory>./Tests</directory>
30+
<directory>./vendor</directory>
3031
</exclude>
3132
</whitelist>
3233
</filter>

‎src/Symfony/Component/Security/Http/phpunit.xml.dist

Copy file name to clipboardExpand all lines: src/Symfony/Component/Security/Http/phpunit.xml.dist
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
<whitelist>
2626
<directory>./</directory>
2727
<exclude>
28-
<directory>./vendor</directory>
2928
<directory>./Tests</directory>
29+
<directory>./vendor</directory>
3030
</exclude>
3131
</whitelist>
3232
</filter>

‎src/Symfony/Component/Security/phpunit.xml.dist

Copy file name to clipboardExpand all lines: src/Symfony/Component/Security/phpunit.xml.dist
+6-8Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,20 @@
1313
<testsuites>
1414
<testsuite name="Symfony Security Component Test Suite">
1515
<directory>./Tests/</directory>
16-
<directory>./Acl/Tests/</directory>
17-
<directory>./Core/Tests/</directory>
18-
<directory>./Http/Tests/</directory>
19-
<directory>./Guard/Tests/</directory>
16+
<directory>./*/Tests/</directory>
2017
</testsuite>
2118
</testsuites>
2219

2320
<filter>
2421
<whitelist>
2522
<directory>./</directory>
2623
<exclude>
27-
<directory>./vendor</directory>
24+
<directory>./Resources</directory>
2825
<directory>./Tests</directory>
29-
<directory>./Acl/Tests</directory>
30-
<directory>./Core/Tests</directory>
31-
<directory>./Http/Tests</directory>
26+
<directory>./vendor</directory>
27+
<directory>./*/Resources</directory>
28+
<directory>./*/Tests</directory>
29+
<directory>./*/vendor</directory>
3230
</exclude>
3331
</whitelist>
3432
</filter>

‎src/Symfony/Component/Serializer/Encoder/JsonDecode.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Serializer/Encoder/JsonDecode.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public function decode($data, $format, array $context = array())
8888
$decodedData = json_decode($data, $associative, $recursionDepth, $options);
8989

9090
if (JSON_ERROR_NONE !== $this->lastError = json_last_error()) {
91-
throw new UnexpectedValueException(json_last_error_message());
91+
throw new UnexpectedValueException(json_last_error_msg());
9292
}
9393

9494
return $decodedData;

‎src/Symfony/Component/Serializer/Encoder/JsonEncode.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Serializer/Encoder/JsonEncode.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function encode($data, $format, array $context = array())
4040
$encodedJson = json_encode($data, $context['json_encode_options']);
4141

4242
if (JSON_ERROR_NONE !== $this->lastError = json_last_error()) {
43-
throw new UnexpectedValueException(json_last_error_message());
43+
throw new UnexpectedValueException(json_last_error_msg());
4444
}
4545

4646
return $encodedJson;

‎src/Symfony/Component/Serializer/Normalizer/ObjectNormalizer.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Serializer/Normalizer/ObjectNormalizer.php
+4-1Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ public function normalize($object, $format = null, array $context = array())
6868
$reflClass = new \ReflectionClass($object);
6969
foreach ($reflClass->getMethods(\ReflectionMethod::IS_PUBLIC) as $reflMethod) {
7070
if (
71+
!$reflMethod->isStatic() &&
7172
!$reflMethod->isConstructor() &&
7273
!$reflMethod->isDestructor() &&
7374
0 === $reflMethod->getNumberOfRequiredParameters()
@@ -86,7 +87,9 @@ public function normalize($object, $format = null, array $context = array())
8687

8788
// properties
8889
foreach ($reflClass->getProperties(\ReflectionProperty::IS_PUBLIC) as $reflProperty) {
89-
$attributes[$reflProperty->getName()] = true;
90+
if (!$reflProperty->isStatic()) {
91+
$attributes[$reflProperty->getName()] = true;
92+
}
9093
}
9194

9295
$attributes = array_keys($attributes);
+44Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Component\Serializer\Tests\Encoder;
13+
14+
use Symfony\Component\Serializer\Encoder\JsonDecode;
15+
16+
class JsonDecodeTest extends \PHPUnit_Framework_TestCase
17+
{
18+
/** @var \Symfony\Component\Serializer\Encoder\JsonDecode */
19+
private $decoder;
20+
21+
protected function setUp()
22+
{
23+
$this->decoder = new JsonDecode(true);
24+
}
25+
26+
public function testDecodeWithValidData()
27+
{
28+
$json = json_encode(array(
29+
'hello' => 'world',
30+
));
31+
$result = $this->decoder->decode($json, 'json');
32+
$this->assertEquals(array(
33+
'hello' => 'world',
34+
), $result);
35+
}
36+
37+
/**
38+
* @expectedException \Symfony\Component\Serializer\Exception\UnexpectedValueException
39+
*/
40+
public function testDecodeWithInvalidData()
41+
{
42+
$result = $this->decoder->decode('kaboom!', 'json');
43+
}
44+
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.