8000 Merge branch '3.0' · symfony/symfony@d859e0e · GitHub
[go: up one dir, main page]

Skip to content

Commit d859e0e

Browse files
committed
Merge branch '3.0'
* 3.0: [Process] Fix stopping a process on Windows [PhpUnitBridge] Add weak-verbose mode and match against message instead of test name Added a note about the new requirement iconv. Improved error messages for Yaml Deprecations Added a test case for the Logger class. [Form] Fix choices defined as Traversable CS: general fixes Suggested Process dependency
2 parents 115b745 + d553264 commit d859e0e

File tree

19 files changed

+125
-69
lines changed

19 files changed

+125
-69
lines changed

src/Symfony/Bridge/Doctrine/Security/RememberMe/DoctrineTokenProvider.php

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,16 @@ public function updateToken($series, $tokenValue, \DateTime $lastUsed)
9292
{
9393
$sql = 'UPDATE rememberme_token SET value=:value, lastUsed=:lastUsed'
9494
.' WHERE series=:series';
95-
$paramValues = array('value' => $tokenValue,
96-
'lastUsed' => $lastUsed,
97-
'series' => $series,);
98-
$paramTypes = array('value' => \PDO::PARAM_STR,
99-
'lastUsed' => DoctrineType::DATETIME,
100-
'series' => \PDO::PARAM_STR,);
95+
$paramValues = array(
96+
'value' => $tokenValue,
97+
'lastUsed' => $lastUsed,
98+
'series' => $series,
99+
);
100+
$paramTypes = array(
101+
'value' => \PDO::PARAM_STR,
102+
'lastUsed' => DoctrineType::DATETIME,
103+
'series' => \PDO::PARAM_STR,
104+
);
101105
$updated = $this->conn->executeUpdate($sql, $paramValues, $paramTypes);
102106
if ($updated < 1) {
103107
throw new TokenNotFoundException('No token found.');
@@ -112,16 +116,20 @@ public function createNewToken(PersistentTokenInterface $token)
112116
$sql = 'INSERT INTO rememberme_token'
113117
.' (class, username, series, value, lastUsed)'
114118
.' VALUES (:class, :username, :series, :value, :lastUsed)';
115-
$paramValues = array('class' => $token->getClass(),
116-
'username' => $token->getUsername(),
117-
'series' => $token->getSeries(),
118-
'value' => $token->getTokenValue(),
119-
'lastUsed' => $token->getLastUsed(),);
120-
$paramTypes = array('class' => \PDO::PARAM_STR,
121-
'username' => \PDO::PARAM_STR,
122-
'series' => \PDO::PARAM_STR,
123-
'value' => \PDO::PARAM_STR,
124-
'lastUsed' => DoctrineType::DATETIME,);
119+
$paramValues = array(
120+
'class' => $token->getClass(),
121+
'username' => $token->getUsername(),
122+
'series' => $token->getSeries(),
123+
'value' => $token->getTokenValue(),
124+
'lastUsed' => $token->getLastUsed(),
125+
);
126+
$paramTypes = array(
127+
'class' => \PDO::PARAM_STR,
128+
'username' => \PDO::PARAM_STR,
129+
'series' => \PDO::PARAM_STR,
130+
'value' => \PDO::PARAM_STR,
131+
'lastUsed' => DoctrineType::DATETIME,
132+
);
125133
$this->conn->executeUpdate($sql, $paramValues, $paramTypes);
126134
}
127135
}

src/Symfony/Bridge/Monolog/Tests/LoggerTest.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,19 @@ public function testCountErrorsWithDebugHandler()
5353
$this->assertSame(4, $logger->countErrors());
5454
}
5555

56+
public function testGetLogs()
57+
{
58+
$logger = new Logger('test');
59+
$logger->pushHandler(new DebugHandler());
60+
61+
$logger->addInfo('test');
62+
$this->assertCount(1, $logger->getLogs());
63+
list($record) = $logger->getLogs();
64+
65+
$this->assertEquals('test', $record['message']);
66+
$this->assertEquals(Logger::INFO, $record['priority']);
67+
}
68+
5669
public function testCountErrorsWithoutDebugHandler()
5770
{
5871
$handler = new TestHandler();

src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
*/
1919
class DeprecationErrorHandler
2020
{
21+
const MODE_WEAK = 'weak';
22+
const MODE_WEAK_VERBOSE = 'weak-verbose';
23+
2124
private static $isRegistered = false;
2225

2326
public static function register($mode = false)
@@ -64,7 +67,7 @@ public static function register($mode = false)
6467
$group = 'remaining';
6568
}
6669

67-
if (isset($mode[0]) && '/' === $mode[0] && preg_match($mode, $class.'::'.$method)) {
70+
if (isset($mode[0]) && '/' === $mode[0] && preg_match($mode, $msg)) {
6871
$e = new \Exception($msg);
6972
$r = new \ReflectionProperty($e, 'trace');
7073
$r->setAccessible(true);
@@ -78,7 +81,7 @@ public static function register($mode = false)
7881

7982
exit(1);
8083
}
81-
if ('legacy' !== $group && 'weak' !== $mode) {
84+
if ('legacy' !== $group && self::MODE_WEAK !== $mode) {
8285
$ref = &$deprecations[$group][$msg]['count'];
8386
++$ref;
8487
$ref = &$deprecations[$group][$msg][$class.'::'.$method];
@@ -144,7 +147,7 @@ public static function register($mode = false)
144147
if (!empty($notices)) {
145148
echo "\n";
146149
}
147-
if ('weak' !== $mode && ($deprecations['unsilenced'] || $deprecations['remaining'] || $deprecations['other'])) {
150+
if (self::MODE_WEAK !== $mode && self::MODE_WEAK_VERBOSE !== $mode && ($deprecations['unsilenced'] || $deprecations['remaining'] || $deprecations['other'])) {
148151
exit(1);
149152
}
150153
10000 });

src/Symfony/Bridge/PhpUnit/README.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ It comes with the following features:
1414
By default any non-legacy-tagged or any non-@-silenced deprecation notices will
1515
make tests fail.
1616
This can be changed by setting the `SYMFONY_DEPRECATIONS_HELPER` environment
17-
variable to `weak`. This will make the bridge ignore deprecation notices and
18-
is useful to projects that must use deprecated interfaces for backward
19-
compatibility reasons.
17+
variable to `weak` or `weak-verbose`. This will make the bridge ignore
18+
deprecation notices and is useful to projects that must use deprecated interfaces
19+
for backward compatibility reasons.
2020

2121
A summary of deprecation notices is displayed at the end of the test suite:
2222

@@ -53,8 +53,9 @@ You have to decide either to:
5353
forward compatibility;
5454
* or move them to the **Legacy** section (by using one of the above way).
5555

56-
In case you need to inspect the stack trace of a particular deprecation triggered by
57-
one of your unit tests, you can set the `SYMFONY_DEPRECATIONS_HELPER` env var to
58-
a regexp that matches this test case's `class::method` name. For example,
59-
`SYMFONY_DEPRECATIONS_HELPER=/^MyTest::testMethod$/ phpunit` will stop your test
60-
suite once a deprecation is triggered by the `MyTest::testMethod` test.
56+
In case you need to inspect the stack trace of a particular deprecation triggered
57+
by your unit tests, you can set the `SYMFONY_DEPRECATIONS_HELPER` env var to a
58+
regular expression that matches this deprecation's message, encapsed between `/`.
59+
For example, `SYMFONY_DEPRECATIONS_HELPER=/foobar/ phpunit` will stop your test
60+
suite once a deprecation notice is triggered whose message contains the "foobar"
61+
string.

src/Symfony/Bridge/Twig/Tests/Extension/TranslationExtensionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function testEscaping()
3131
public function testTrans($template, $expected, array $variables = array())
3232
{
3333
if ($expected != $this->getTemplate($template)->render($variables)) {
34-
print $template."\n";
34+
echo $template."\n";
3535
$loader = new \Twig_Loader_Array(array('index' => $template));
3636
$twig = new \Twig_Environment($loader, array('debug' => true, 'cache' => false));
3737
$twig->addExtension(new TranslationExtension(new Translator('en', new MessageSelector())));

src/Symfony/Bundle/FrameworkBundle/composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@
5858
"symfony/serializer": "For using the serializer service",
5959
"symfony/validator": "For using validation",
6060
"symfony/yaml": "For using the debug:config and lint:yaml commands",
61-
"symfony/property-info": "For using the property_info_extractor service"
61+
"symfony/property-info": "For using the property_info_extractor service",
62+
"symfony/process": "For using the server:run command"
6263
},
6364
"autoload": {
6465
"psr-4": { "Symfony\\Bundle\\FrameworkBundle\\": "" },

src/Symfony/Bundle/WebProfilerBundle/Tests/Profiler/TemplateManagerTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ protected function setUp()
4848
$profiler = $this->mockProfiler();
4949
$twigEnvironment = $this->mockTwigEnvironment();
5050
$templates = array(
51-
'data_collector.foo' => array('foo','FooBundle:Collector:foo'),
52-
'data_collector.bar' => array('bar','FooBundle:Collector:bar'),
53-
'data_collector.baz' => array('baz','FooBundle:Collector:baz'),
51+
'data_collector.foo' => array('foo', 'FooBundle:Collector:foo'),
52+
'data_collector.bar' => array('bar', 'FooBundle:Collector:bar'),
53+
'data_collector.baz' => array('baz', 'FooBundle:Collector:baz'),
5454
);
5555

5656
$this->templateManager = new TemplateManager($profiler, $twigEnvironment, $templates);

src/Symfony/Component/ClassLoader/ClassLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public function addPrefix($prefix, $paths)
9797
$paths
9898
));
9999
} elseif (!in_array($paths, $this->prefixes[$prefix])) {
100-
$this->prefixes[$prefix][] = $paths;
100+
$this->prefixes[$prefix][] = $paths;
101101
}
102102
} else {
103103
$this->prefixes[$prefix] = array_unique((array) $paths);

src/Symfony/Component/Console/Tests/Input/StringInputTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public function getTokenizeData()
5050
array('"quoted"', array('quoted'), '->tokenize() parses quoted arguments'),
5151
array("'quoted'", array('quoted'), '->tokenize() parses quoted arguments'),
5252
array("'a\rb\nc\td'", array("a\rb\nc\td"), '->tokenize() parses whitespace chars in strings'),
53-
array("'a'\r'b'\n'c'\t'd'", array('a','b','c','d'), '->tokenize() parses whitespace chars between args as spaces'),
53+
array("'a'\r'b'\n'c'\t'd'", array('a', 'b', 'c', 'd'), '->tokenize() parses whitespace chars between args as spaces'),
5454
array('\"quoted\"', array('"quoted"'), '->tokenize() parses escaped-quoted arguments'),
5555
array("\'quoted\'", array('\'quoted\''), '->tokenize() parses escaped-quoted arguments'),
5656
array('-a', array('-a'), '->tokenize() parses short options'),

src/Symfony/Component/CssSelector/Tests/Node/ElementNodeTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public function getSpecificityValueTestData()
2929
return array(
3030
array(new ElementNode(), 0),
3131
array(new ElementNode(null, 'element'), 1),
32-
array(new ElementNode('namespace', 'element'),1),
32+
array(new ElementNode('namespace', 'element'), 1),
3333
);
3434
}
3535
}

0 commit comments

Comments
 (0)
0