composeer update
This commit is contained in:
@@ -91,6 +91,10 @@ class RedirectResponseTest extends TestCase
|
||||
$this->assertFalse($response->headers->hasCacheControlDirective('no-cache'));
|
||||
$this->assertTrue($response->headers->hasCacheControlDirective('max-age'));
|
||||
|
||||
$response = new RedirectResponse('foo.bar', 301, ['Cache-Control' => 'max-age=86400']);
|
||||
$this->assertFalse($response->headers->hasCacheControlDirective('no-cache'));
|
||||
$this->assertTrue($response->headers->hasCacheControlDirective('max-age'));
|
||||
|
||||
$response = new RedirectResponse('foo.bar', 302);
|
||||
$this->assertTrue($response->headers->hasCacheControlDirective('no-cache'));
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ class MemcachedSessionHandlerTest extends TestCase
|
||||
$this->memcached
|
||||
->expects($this->once())
|
||||
->method('quit')
|
||||
->will($this->returnValue(true))
|
||||
->willReturn(true)
|
||||
;
|
||||
|
||||
$this->assertTrue($this->storage->close());
|
||||
@@ -85,7 +85,7 @@ class MemcachedSessionHandlerTest extends TestCase
|
||||
->expects($this->once())
|
||||
->method('set')
|
||||
->with(self::PREFIX.'id', 'data', $this->equalTo(time() + self::TTL, 2))
|
||||
->will($this->returnValue(true))
|
||||
->willReturn(true)
|
||||
;
|
||||
|
||||
$this->assertTrue($this->storage->write('id', 'data'));
|
||||
@@ -97,7 +97,7 @@ class MemcachedSessionHandlerTest extends TestCase
|
||||
->expects($this->once())
|
||||
->method('delete')
|
||||
->with(self::PREFIX.'id')
|
||||
->will($this->returnValue(true))
|
||||
->willReturn(true)
|
||||
;
|
||||
|
||||
$this->assertTrue($this->storage->destroy('id'));
|
||||
|
||||
@@ -38,11 +38,11 @@ class MigratingSessionHandlerTest extends TestCase
|
||||
{
|
||||
$this->currentHandler->expects($this->once())
|
||||
->method('close')
|
||||
->will($this->returnValue(true));
|
||||
->willReturn(true);
|
||||
|
||||
$this->writeOnlyHandler->expects($this->once())
|
||||
->method('close')
|
||||
->will($this->returnValue(false));
|
||||
->willReturn(false);
|
||||
|
||||
$result = $this->dualHandler->close();
|
||||
|
||||
@@ -56,12 +56,12 @@ class MigratingSessionHandlerTest extends TestCase
|
||||
$this->currentHandler->expects($this->once())
|
||||
->method('destroy')
|
||||
->with($sessionId)
|
||||
->will($this->returnValue(true));
|
||||
->willReturn(true);
|
||||
|
||||
$this->writeOnlyHandler->expects($this->once())
|
||||
->method('destroy')
|
||||
->with($sessionId)
|
||||
->will($this->returnValue(false));
|
||||
->willReturn(false);
|
||||
|
||||
$result = $this->dualHandler->destroy($sessionId);
|
||||
|
||||
@@ -75,12 +75,12 @@ class MigratingSessionHandlerTest extends TestCase
|
||||
$this->currentHandler->expects($this->once())
|
||||
->method('gc')
|
||||
->with($maxlifetime)
|
||||
->will($this->returnValue(true));
|
||||
->willReturn(true);
|
||||
|
||||
$this->writeOnlyHandler->expects($this->once())
|
||||
->method('gc')
|
||||
->with($maxlifetime)
|
||||
->will($this->returnValue(false));
|
||||
->willReturn(false);
|
||||
|
||||
$result = $this->dualHandler->gc($maxlifetime);
|
||||
$this->assertTrue($result);
|
||||
@@ -94,12 +94,12 @@ class MigratingSessionHandlerTest extends TestCase
|
||||
$this->currentHandler->expects($this->once())
|
||||
->method('open')
|
||||
->with($savePath, $sessionName)
|
||||
->will($this->returnValue(true));
|
||||
->willReturn(true);
|
||||
|
||||
$this->writeOnlyHandler->expects($this->once())
|
||||
->method('open')
|
||||
->with($savePath, $sessionName)
|
||||
->will($this->returnValue(false));
|
||||
->willReturn(false);
|
||||
|
||||
$result = $this->dualHandler->open($savePath, $sessionName);
|
||||
|
||||
@@ -114,7 +114,7 @@ class MigratingSessionHandlerTest extends TestCase
|
||||
$this->currentHandler->expects($this->once())
|
||||
->method('read')
|
||||
->with($sessionId)
|
||||
->will($this->returnValue($readValue));
|
||||
->willReturn($readValue);
|
||||
|
||||
$this->writeOnlyHandler->expects($this->never())
|
||||
->method('read')
|
||||
@@ -133,12 +133,12 @@ class MigratingSessionHandlerTest extends TestCase
|
||||
$this->currentHandler->expects($this->once())
|
||||
->method('write')
|
||||
->with($sessionId, $data)
|
||||
->will($this->returnValue(true));
|
||||
->willReturn(true);
|
||||
|
||||
$this->writeOnlyHandler->expects($this->once())
|
||||
->method('write')
|
||||
->with($sessionId, $data)
|
||||
->will($this->returnValue(false));
|
||||
->willReturn(false);
|
||||
|
||||
$result = $this->dualHandler->write($sessionId, $data);
|
||||
|
||||
@@ -153,7 +153,7 @@ class MigratingSessionHandlerTest extends TestCase
|
||||
$this->currentHandler->expects($this->once())
|
||||
->method('read')
|
||||
->with($sessionId)
|
||||
->will($this->returnValue($readValue));
|
||||
->willReturn($readValue);
|
||||
|
||||
$this->writeOnlyHandler->expects($this->never())
|
||||
->method('read')
|
||||
@@ -172,12 +172,12 @@ class MigratingSessionHandlerTest extends TestCase
|
||||
$this->currentHandler->expects($this->once())
|
||||
->method('write')
|
||||
->with($sessionId, $data)
|
||||
->will($this->returnValue(true));
|
||||
->willReturn(true);
|
||||
|
||||
$this->writeOnlyHandler->expects($this->once())
|
||||
->method('write')
|
||||
->with($sessionId, $data)
|
||||
->will($this->returnValue(false));
|
||||
->willReturn(false);
|
||||
|
||||
$result = $this->dualHandler->updateTimestamp($sessionId, $data);
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ class MongoDbSessionHandlerTest extends TestCase
|
||||
$this->mongo->expects($this->once())
|
||||
->method('selectCollection')
|
||||
->with($this->options['database'], $this->options['collection'])
|
||||
->will($this->returnValue($collection));
|
||||
->willReturn($collection);
|
||||
|
||||
// defining the timeout before the actual method call
|
||||
// allows to test for "greater than" values in the $criteria
|
||||
@@ -85,7 +85,7 @@ class MongoDbSessionHandlerTest extends TestCase
|
||||
|
||||
$collection->expects($this->once())
|
||||
->method('findOne')
|
||||
->will($this->returnCallback(function ($criteria) use ($testTimeout) {
|
||||
->willReturnCallback(function ($criteria) use ($testTimeout) {
|
||||
$this->assertArrayHasKey($this->options['id_field'], $criteria);
|
||||
$this->assertEquals($criteria[$this->options['id_field']], 'foo');
|
||||
|
||||
@@ -100,7 +100,7 @@ class MongoDbSessionHandlerTest extends TestCase
|
||||
$this->options['expiry_field'] => new \MongoDB\BSON\UTCDateTime(),
|
||||
$this->options['data_field'] => new \MongoDB\BSON\Binary('bar', \MongoDB\BSON\Binary::TYPE_OLD_BINARY),
|
||||
];
|
||||
}));
|
||||
});
|
||||
|
||||
$this->assertEquals('bar', $this->storage->read('foo'));
|
||||
}
|
||||
@@ -112,11 +112,11 @@ class MongoDbSessionHandlerTest extends TestCase
|
||||
$this->mongo->expects($this->once())
|
||||
->method('selectCollection')
|
||||
->with($this->options['database'], $this->options['collection'])
|
||||
->will($this->returnValue($collection));
|
||||
->willReturn($collection);
|
||||
|
||||
$collection->expects($this->once())
|
||||
->method('updateOne')
|
||||
->will($this->returnCallback(function ($criteria, $updateData, $options) {
|
||||
->willReturnCallback(function ($criteria, $updateData, $options) {
|
||||
$this->assertEquals([$this->options['id_field'] => 'foo'], $criteria);
|
||||
$this->assertEquals(['upsert' => true], $options);
|
||||
|
||||
@@ -127,7 +127,7 @@ class MongoDbSessionHandlerTest extends TestCase
|
||||
$this->assertInstanceOf(\MongoDB\BSON\UTCDateTime::class, $data[$this->options['time_field']]);
|
||||
$this->assertInstanceOf(\MongoDB\BSON\UTCDateTime::class, $data[$this->options['expiry_field']]);
|
||||
$this->assertGreaterThanOrEqual($expectedExpiry, round((string) $data[$this->options['expiry_field']] / 1000));
|
||||
}));
|
||||
});
|
||||
|
||||
$this->assertTrue($this->storage->write('foo', 'bar'));
|
||||
}
|
||||
@@ -139,15 +139,15 @@ class MongoDbSessionHandlerTest extends TestCase
|
||||
$this->mongo->expects($this->once())
|
||||
->method('selectCollection')
|
||||
->with($this->options['database'], $this->options['collection'])
|
||||
->will($this->returnValue($collection));
|
||||
->willReturn($collection);
|
||||
|
||||
$data = [];
|
||||
|
||||
$collection->expects($this->exactly(2))
|
||||
->method('updateOne')
|
||||
->will($this->returnCallback(function ($criteria, $updateData, $options) use (&$data) {
|
||||
->willReturnCallback(function ($criteria, $updateData, $options) use (&$data) {
|
||||
$data = $updateData;
|
||||
}));
|
||||
});
|
||||
|
||||
$this->storage->write('foo', 'bar');
|
||||
$this->storage->write('foo', 'foobar');
|
||||
@@ -162,7 +162,7 @@ class MongoDbSessionHandlerTest extends TestCase
|
||||
$this->mongo->expects($this->once())
|
||||
->method('selectCollection')
|
||||
->with($this->options['database'], $this->options['collection'])
|
||||
->will($this->returnValue($collection));
|
||||
->willReturn($collection);
|
||||
|
||||
$collection->expects($this->once())
|
||||
->method('deleteOne')
|
||||
@@ -178,14 +178,14 @@ class MongoDbSessionHandlerTest extends TestCase
|
||||
$this->mongo->expects($this->once())
|
||||
->method('selectCollection')
|
||||
->with($this->options['database'], $this->options['collection'])
|
||||
->will($this->returnValue($collection));
|
||||
->willReturn($collection);
|
||||
|
||||
$collection->expects($this->once())
|
||||
->method('deleteMany')
|
||||
->will($this->returnCallback(function ($criteria) {
|
||||
->willReturnCallback(function ($criteria) {
|
||||
$this->assertInstanceOf(\MongoDB\BSON\UTCDateTime::class, $criteria[$this->options['expiry_field']]['$lt']);
|
||||
$this->assertGreaterThanOrEqual(time() - 1, round((string) $criteria[$this->options['expiry_field']]['$lt'] / 1000));
|
||||
}));
|
||||
});
|
||||
|
||||
$this->assertTrue($this->storage->gc(1));
|
||||
}
|
||||
|
||||
@@ -143,7 +143,7 @@ class PdoSessionHandlerTest extends TestCase
|
||||
$stream = $this->createStream($content);
|
||||
|
||||
$pdo->prepareResult->expects($this->once())->method('fetchAll')
|
||||
->will($this->returnValue([[$stream, 42, time()]]));
|
||||
->willReturn([[$stream, 42, time()]]);
|
||||
|
||||
$storage = new PdoSessionHandler($pdo);
|
||||
$result = $storage->read('foo');
|
||||
@@ -170,14 +170,14 @@ class PdoSessionHandlerTest extends TestCase
|
||||
$exception = null;
|
||||
|
||||
$selectStmt->expects($this->atLeast(2))->method('fetchAll')
|
||||
->will($this->returnCallback(function () use (&$exception, $stream) {
|
||||
->willReturnCallback(function () use (&$exception, $stream) {
|
||||
return $exception ? [[$stream, 42, time()]] : [];
|
||||
}));
|
||||
});
|
||||
|
||||
$insertStmt->expects($this->once())->method('execute')
|
||||
->will($this->returnCallback(function () use (&$exception) {
|
||||
->willReturnCallback(function () use (&$exception) {
|
||||
throw $exception = new \PDOException('', '23');
|
||||
}));
|
||||
});
|
||||
|
||||
$storage = new PdoSessionHandler($pdo);
|
||||
$result = $storage->read('foo');
|
||||
|
||||
@@ -50,7 +50,7 @@ class SessionHandlerProxyTest extends TestCase
|
||||
{
|
||||
$this->mock->expects($this->once())
|
||||
->method('open')
|
||||
->will($this->returnValue(true));
|
||||
->willReturn(true);
|
||||
|
||||
$this->assertFalse($this->proxy->isActive());
|
||||
$this->proxy->open('name', 'id');
|
||||
@@ -61,7 +61,7 @@ class SessionHandlerProxyTest extends TestCase
|
||||
{
|
||||
$this->mock->expects($this->once())
|
||||
->method('open')
|
||||
->will($this->returnValue(false));
|
||||
->willReturn(false);
|
||||
|
||||
$this->assertFalse($this->proxy->isActive());
|
||||
$this->proxy->open('name', 'id');
|
||||
@@ -72,7 +72,7 @@ class SessionHandlerProxyTest extends TestCase
|
||||
{
|
||||
$this->mock->expects($this->once())
|
||||
->method('close')
|
||||
->will($this->returnValue(true));
|
||||
->willReturn(true);
|
||||
|
||||
$this->assertFalse($this->proxy->isActive());
|
||||
$this->proxy->close();
|
||||
@@ -83,7 +83,7 @@ class SessionHandlerProxyTest extends TestCase
|
||||
{
|
||||
$this->mock->expects($this->once())
|
||||
->method('close')
|
||||
->will($this->returnValue(false));
|
||||
->willReturn(false);
|
||||
|
||||
$this->assertFalse($this->proxy->isActive());
|
||||
$this->proxy->close();
|
||||
|
||||
Reference in New Issue
Block a user