8000 bug #9617 [HttpKernel] Http kernel regression fix (hhamon) · symfony/symfony@41b5c8e · GitHub
[go: up one dir, main page]

Skip to content

Commit 41b5c8e

Browse files
committed
bug #9617 [HttpKernel] Http kernel regression fix (hhamon)
This PR was merged into the 2.4 branch. Discussion ---------- [HttpKernel] Http kernel regression fix | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | ~ | License | MIT | Doc PR | ~ Commits ------- d1e5006 [HttpKernel] fixed regression introduced in 2.4 in the base DataCollector class. Added more unit tests coverage for the RequestDataCollector object.
2 parents a5408b0 + d1e5006 commit 41b5c8e

File tree

2 files changed

+21
-17
lines changed

2 files changed

+21
-17
lines changed

src/Symfony/Component/HttpKernel/DataCollector/DataCollector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,6 @@ protected function varToString($var)
5353
$this->valueExporter = new ValueExporter();
5454
}
5555

56-
$this->valueExporter->exportValue($var);
56+
return $this->valueExporter->exportValue($var);
5757
}
5858
}

src/Symfony/Component/HttpKernel/Tests/DataCollector/RequestDataCollectorTest.php

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -31,21 +31,23 @@ public function testCollect(Request $request, Response $response)
3131

3232
$c->collect($request, $response);
3333

34-
$this->assertSame('request',$c->getName 8000 ());
35-
$this->assertInstanceOf('Symfony\Component\HttpFoundation\HeaderBag',$c->getRequestHeaders());
36-
$this->assertInstanceOf('Symfony\Component\HttpFoundation\ParameterBag',$c->getRequestServer());
37-
$this->assertInstanceOf('Symfony\Component\HttpFoundation\ParameterBag',$c->getRequestCookies());
38-
$this->assertInstanceOf('Symfony\Component\HttpFoundation\ParameterBag',$c->getRequestAttributes());
39-
$this->assertInstanceOf('Symfony\Component\HttpFoundation\ParameterBag',$c->getRequestRequest());
40-
$this->assertInstanceOf('Symfony\Component\HttpFoundation\ParameterBag',$c->getRequestQuery());
41-
$this->assertEquals('html',$c->getFormat());
42-
$this->assertEquals(array(),$c->getSessionAttributes());
43-
$this->assertEquals('en',$c->getLocale());
44-
45-
$this->assertInstanceOf('Symfony\Component\HttpFoundation\HeaderBag',$c->getResponseHeaders());
46-
$this->assertEquals('OK',$c->getStatusText());
47-
$this->assertEquals(200,$c->getStatusCode());
48-
$this->assertEquals('application/json',$c->getContentType());
34+
$this->assertSame('request', $c->getName());
35+
$this->assertInstanceOf('Symfony\Component\HttpFoundation\HeaderBag', $c->getRequestHeaders());
36+
$this->assertInstanceOf('Symfony\Component\HttpFoundation\ParameterBag', $c->getRequestServer());
37+
$this->assertInstanceOf('Symfony\Component\HttpFoundation\ParameterBag', $c->getRequestCookies());
38+
$this->assertInstanceOf('Symfony\Component\HttpFoundation\ParameterBag', $c->getRequestAttributes());
39+
$this->assertInstanceOf('Symfony\Component\HttpFoundation\ParameterBag', $c->getRequestRequest());
40+
$this->assertInstanceOf('Symfony\Component\HttpFoundation\ParameterBag', $c->getRequestQuery());
41+
$this->assertSame('html', $c->getFormat());
42+
$this->assertSame('foobar', $c->getRoute());
43+
$this->assertSame(array('name' => 'foo'), $c->getRouteParams());
44+
$this->assertSame(array(), $c->getSessionAttributes());
45+
$this->assertSame('en', $c->getLocale());
46+
47+
$this->assertInstanceOf('Symfony\Component\HttpFoundation\HeaderBag', $c->getResponseHeaders());
48+
$this->assertSame('OK', $c->getStatusText());
49+
$this->assertSame(200, $c->getStatusCode());
50+
$this->assertSame('application/json', $c->getContentType());
4951
}
5052

5153
/**
@@ -138,7 +140,7 @@ function () { return 'foo'; },
138140
foreach ($controllerTests as $controllerTest) {
139141
$this->injectController($c, $controllerTest[1], $request);
140142
$c->collect($request, $response);
141-
$this->assertEquals($controllerTest[2], $c->getController(), sprintf('Testing: %s', $controllerTest[0]));
143+
$this->assertSame($controllerTest[2], $c->getController(), sprintf('Testing: %s', $controllerTest[0]));
142144
}
143145
}
144146

@@ -150,6 +152,8 @@ public function provider()
150152

151153
$request = Request::create('http://test.com/foo?bar=baz');
152154
$request->attributes->set('foo', 'bar');
155+
$request->attributes->set('_route', 'foobar');
156+
$request->attributes->set('_route_params', array('name' => 'foo'));
153157

154158
$response = new Response();
155159
$response->setStatusCode(200);

0 commit comments

Comments
 (0)
0