Skip to content

Commit

Permalink
merged 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
fabpot committed Apr 20, 2012
2 parents 5f98171 + 9b5be1d commit 539634c
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/Symfony/Bridge/Twig/Extension/YamlExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function dump($value)
return '%'.gettype($value).'% '.$this->encode($value);
}

return $value;
return $this->encode($value);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
</trans-unit>
<trans-unit id="6">
<source>You must select at least {{ limit }} choices.</source>
<target>Selecteer tenminste {{ limit }} opties.</target>
<target>Selecteer ten minste {{ limit }} opties.</target>
</trans-unit>
<trans-unit id="7">
<source>You must select at most {{ limit }} choices.</source>
Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Component/HttpFoundation/ParameterBag.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public function get($path, $default = null, $deep = false)

$value = $this->parameters[$root];
$currentKey = null;
for ($i=$pos,$c=strlen($path); $i<$c; $i++) {
for ($i = $pos, $c = strlen($path); $i < $c; $i++) {
$char = $path[$i];

if ('[' === $char) {
Expand Down Expand Up @@ -240,7 +240,7 @@ public function getDigits($key, $default = '', $deep = false)
* @param mixed $default The default value if the parameter key does not exist
* @param boolean $deep If true, a path like foo[bar] will find deeper items
*
* @return string The filtered value
* @return integer The filtered value
*
* @api
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ private function getListenerInfo($listener, $eventName)
if (!is_array($listener)) {
$listener = array($listener, '__invoke');
}
$class = get_class($listener[0]);
$class = is_object($listener[0]) ? get_class($listener[0]) : $listener[0];
try {
$r = new \ReflectionMethod($class, $listener[1]);
$file = $r->getFileName();
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/HttpKernel/HttpCache/Store.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public function lookup(Request $request)
// find a cached entry that matches the request.
$match = null;
foreach ($entries as $entry) {
if ($this->requestsMatch(isset($entry[1]['vary']) ? $entry[1]['vary'][0] : '', $request->headers->all(), $entry[0])) {
if ($this->requestsMatch(isset($entry[1]['vary'][0]) ? $entry[1]['vary'][0] : '', $request->headers->all(), $entry[0])) {
$match = $entry;

break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,26 @@ public function testClosureDoesNotTriggerErrorNotice()

$this->assertTrue($triggered, 'Closure should have been executed upon dispatch');
}

public function testStaticCallable()
{
$container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
$dispatcher = new ContainerAwareTraceableEventDispatcher($container, new StopWatch());

$dispatcher->addListener('onFooEvent', array(__NAMESPACE__.'\StaticClassFixture', 'staticListener'));

$dispatcher->dispatch('onFooEvent');

$this->assertTrue(StaticClassFixture::$called);
}
}

class StaticClassFixture
{
static public $called = false;

static public function staticListener($event)
{
self::$called = true;
}
}
10 changes: 8 additions & 2 deletions src/Symfony/Component/Yaml/Tests/ParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,14 @@ protected function tearDown()
/**
* @dataProvider getDataFormSpecifications
*/
public function testSpecifications($expected, $yaml, $comment)
public function testSpecifications($file, $expected, $yaml, $comment)
{
if ('escapedCharacters' == $file) {
if (!function_exists('iconv') && !function_exists('mb_convert_encoding')) {
$this->markTestSkipped('The iconv and mbstring extensions are not available.');
}
}

$this->assertEquals($expected, var_export($this->parser->parse($yaml), true), $comment);
}

Expand All @@ -59,7 +65,7 @@ public function getDataFormSpecifications()
} else {
$expected = var_export(eval('return '.trim($test['php']).';'), true);

$tests[] = array($expected, $test['yaml'], $test['test']);
$tests[] = array($file, $expected, $test['yaml'], $test['test']);
}
}
}
Expand Down

0 comments on commit 539634c

Please sign in to comment.