Laravel version update
Laravel version update
This commit is contained in:
@@ -11,10 +11,11 @@
|
||||
|
||||
namespace Symfony\Component\HttpKernel\Tests\Profiler;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\HttpKernel\Profiler\FileProfilerStorage;
|
||||
use Symfony\Component\HttpKernel\Profiler\Profile;
|
||||
|
||||
class FileProfilerStorageTest extends \PHPUnit_Framework_TestCase
|
||||
class FileProfilerStorageTest extends TestCase
|
||||
{
|
||||
private $tmpDir;
|
||||
private $storage;
|
||||
@@ -82,22 +83,22 @@ class FileProfilerStorageTest extends \PHPUnit_Framework_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()
|
||||
@@ -127,6 +128,20 @@ class FileProfilerStorageTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertCount(0, $this->storage->find('127.0._.1', '', 10, 'GET'), '->find() does not interpret a "_" as a wildcard in the IP');
|
||||
}
|
||||
|
||||
public function testRetrieveByStatusCode()
|
||||
{
|
||||
$profile200 = new Profile('statuscode200');
|
||||
$profile200->setStatusCode(200);
|
||||
$this->storage->write($profile200);
|
||||
|
||||
$profile404 = new Profile('statuscode404');
|
||||
$profile404->setStatusCode(404);
|
||||
$this->storage->write($profile404);
|
||||
|
||||
$this->assertCount(1, $this->storage->find(null, null, 10, null, null, null, '200'), '->find() retrieve a record by Status code 200');
|
||||
$this->assertCount(1, $this->storage->find(null, null, 10, null, null, null, '404'), '->find() retrieve a record by Status code 404');
|
||||
}
|
||||
|
||||
public function testRetrieveByUrl()
|
||||
{
|
||||
$profile = new Profile('simple_quote');
|
||||
@@ -232,7 +247,7 @@ class FileProfilerStorageTest extends \PHPUnit_Framework_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');
|
||||
@@ -241,7 +256,7 @@ class FileProfilerStorageTest extends \PHPUnit_Framework_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();
|
||||
|
@@ -11,13 +11,15 @@
|
||||
|
||||
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;
|
||||
|
||||
class ProfilerTest extends \PHPUnit_Framework_TestCase
|
||||
class ProfilerTest extends TestCase
|
||||
{
|
||||
private $tmp;
|
||||
private $storage;
|
||||
@@ -32,10 +34,24 @@ class ProfilerTest extends \PHPUnit_Framework_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->assertEquals(array('foo' => 'bar'), $profiler->get('request')->getRequestQuery()->all());
|
||||
$this->assertSame('bar', $profile->getCollector('request')->getRequestQuery()->all()['foo']->getValue());
|
||||
}
|
||||
|
||||
public function testReset()
|
||||
{
|
||||
$collector = $this->getMockBuilder(DataCollectorInterface::class)
|
||||
->setMethods(array('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()
|
||||
@@ -59,6 +75,13 @@ class ProfilerTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertCount(0, $profiler->find(null, null, null, null, 'some string', ''));
|
||||
}
|
||||
|
||||
public function testFindWorksWithStatusCode()
|
||||
{
|
||||
$profiler = new Profiler($this->storage);
|
||||
|
||||
$this->assertCount(0, $profiler->find(null, null, null, null, null, null, '204'));
|
||||
}
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
$this->tmp = tempnam(sys_get_temp_dir(), 'sf2_profiler');
|
||||
|
Reference in New Issue
Block a user