Upgrade 1-11.38

This commit is contained in:
xesmyd
2026-03-30 14:10:30 +02:00
parent f2a7e6d1fc
commit ac648ef29d
24665 changed files with 69682 additions and 2205004 deletions
@@ -83,22 +83,22 @@ class FileProfilerStorageTest extends TestCase
$profile = new Profile('simple_quote');
$profile->setUrl('http://foo.bar/\'');
$this->storage->write($profile);
$this->assertTrue(false !== $this->storage->read('simple_quote'), '->write() accepts single quotes in URL');
$this->assertNotFalse($this->storage->read('simple_quote'), '->write() accepts single quotes in URL');
$profile = new Profile('double_quote');
$profile->setUrl('http://foo.bar/"');
$this->storage->write($profile);
$this->assertTrue(false !== $this->storage->read('double_quote'), '->write() accepts double quotes in URL');
$this->assertNotFalse($this->storage->read('double_quote'), '->write() accepts double quotes in URL');
$profile = new Profile('backslash');
$profile->setUrl('http://foo.bar/\\');
$this->storage->write($profile);
$this->assertTrue(false !== $this->storage->read('backslash'), '->write() accepts backslash in URL');
$this->assertNotFalse($this->storage->read('backslash'), '->write() accepts backslash in URL');
$profile = new Profile('comma');
$profile->setUrl('http://foo.bar/,');
$this->storage->write($profile);
$this->assertTrue(false !== $this->storage->read('comma'), '->write() accepts comma in URL');
$this->assertNotFalse($this->storage->read('comma'), '->write() accepts comma in URL');
}
public function testStoreDuplicateToken()
@@ -205,9 +205,9 @@ class FileProfilerStorageTest extends TestCase
$records = $this->storage->find('', '', 3, 'GET', $start, time() + 3 * 60);
$this->assertCount(3, $records, '->find() returns all previously added records');
$this->assertEquals($records[0]['token'], 'time_2', '->find() returns records ordered by time in descendant order');
$this->assertEquals($records[1]['token'], 'time_1', '->find() returns records ordered by time in descendant order');
$this->assertEquals($records[2]['token'], 'time_0', '->find() returns records ordered by time in descendant order');
$this->assertEquals('time_2', $records[0]['token'], '->find() returns records ordered by time in descendant order');
$this->assertEquals('time_1', $records[1]['token'], '->find() returns records ordered by time in descendant order');
$this->assertEquals('time_0', $records[2]['token'], '->find() returns records ordered by time in descendant order');
$records = $this->storage->find('', '', 3, 'GET', $start, time() + 2 * 60);
$this->assertCount(2, $records, '->find() should return only first two of the previously added records');
@@ -226,7 +226,7 @@ class FileProfilerStorageTest extends TestCase
public function testRetrieveByMethodAndLimit()
{
foreach (array('POST', 'GET') as $method) {
foreach (['POST', 'GET'] as $method) {
for ($i = 0; $i < 5; ++$i) {
$profile = new Profile('token_'.$i.$method);
$profile->setMethod($method);
@@ -247,7 +247,7 @@ class FileProfilerStorageTest extends TestCase
$profile->setMethod('GET');
$this->storage->write($profile);
$this->assertTrue(false !== $this->storage->read('token1'));
$this->assertNotFalse($this->storage->read('token1'));
$this->assertCount(1, $this->storage->find('127.0.0.1', '', 10, 'GET'));
$profile = new Profile('token2');
@@ -256,7 +256,7 @@ class FileProfilerStorageTest extends TestCase
$profile->setMethod('GET');
$this->storage->write($profile);
$this->assertTrue(false !== $this->storage->read('token2'));
$this->assertNotFalse($this->storage->read('token2'));
$this->assertCount(2, $this->storage->find('127.0.0.1', '', 10, 'GET'));
$this->storage->purge();
@@ -293,8 +293,8 @@ class FileProfilerStorageTest extends TestCase
$tokens = $this->storage->find('', '', 10, '');
$this->assertCount(2, $tokens);
$this->assertContains($tokens[0]['status_code'], array(200, 404));
$this->assertContains($tokens[1]['status_code'], array(200, 404));
$this->assertContains((int) $tokens[0]['status_code'], [200, 404]);
$this->assertContains((int) $tokens[1]['status_code'], [200, 404]);
}
public function testMultiRowIndexFile()
@@ -329,7 +329,7 @@ class FileProfilerStorageTest extends TestCase
$h = tmpfile();
fwrite($h, "line1\n\n\nline2\n");
fseek($h, 0, SEEK_END);
fseek($h, 0, \SEEK_END);
$this->assertEquals('line2', $r->invoke($this->storage, $h));
$this->assertEquals('line1', $r->invoke($this->storage, $h));
+18 -4
View File
@@ -12,12 +12,12 @@
namespace Symfony\Component\HttpKernel\Tests\Profiler;
use PHPUnit\Framework\TestCase;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\DataCollector\DataCollectorInterface;
use Symfony\Component\HttpKernel\DataCollector\RequestDataCollector;
use Symfony\Component\HttpKernel\Profiler\FileProfilerStorage;
use Symfony\Component\HttpKernel\Profiler\Profiler;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\VarDumper\Cloner\Data;
class ProfilerTest extends TestCase
{
@@ -34,10 +34,24 @@ class ProfilerTest extends TestCase
$profiler = new Profiler($this->storage);
$profiler->add($collector);
$profile = $profiler->collect($request, $response);
$profiler->saveProfile($profile);
$this->assertSame(204, $profile->getStatusCode());
$this->assertSame('GET', $profile->getMethod());
$this->assertInstanceOf(Data::class, $profiler->get('request')->getRequestQuery()->all()['foo']);
$this->assertSame('bar', $profile->getCollector('request')->getRequestQuery()->all()['foo']->getValue());
}
public function testReset()
{
$collector = $this->getMockBuilder(DataCollectorInterface::class)
->setMethods(['collect', 'getName', 'reset'])
->getMock();
$collector->expects($this->any())->method('getName')->willReturn('mock');
$collector->expects($this->once())->method('reset');
$profiler = new Profiler($this->storage);
$profiler->add($collector);
$profiler->reset();
}
public function testFindWorksWithDates()