Laravel version update
Laravel version update
This commit is contained in:
@@ -11,47 +11,16 @@
|
||||
|
||||
namespace Symfony\Component\HttpFoundation\Tests\Session\Storage\Proxy;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\HttpFoundation\Session\Storage\Proxy\AbstractProxy;
|
||||
|
||||
// Note until PHPUnit_Mock_Objects 1.2 is released you cannot mock abstracts due to
|
||||
// https://github.com/sebastianbergmann/phpunit-mock-objects/issues/73
|
||||
class ConcreteProxy extends AbstractProxy
|
||||
{
|
||||
}
|
||||
|
||||
class ConcreteSessionHandlerInterfaceProxy extends AbstractProxy implements \SessionHandlerInterface
|
||||
{
|
||||
public function open($savePath, $sessionName)
|
||||
{
|
||||
}
|
||||
|
||||
public function close()
|
||||
{
|
||||
}
|
||||
|
||||
public function read($id)
|
||||
{
|
||||
}
|
||||
|
||||
public function write($id, $data)
|
||||
{
|
||||
}
|
||||
|
||||
public function destroy($id)
|
||||
{
|
||||
}
|
||||
|
||||
public function gc($maxlifetime)
|
||||
{
|
||||
}
|
||||
}
|
||||
use Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy;
|
||||
|
||||
/**
|
||||
* Test class for AbstractProxy.
|
||||
*
|
||||
* @author Drak <drak@zikula.org>
|
||||
*/
|
||||
class AbstractProxyTest extends \PHPUnit_Framework_TestCase
|
||||
class AbstractProxyTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @var AbstractProxy
|
||||
@@ -60,7 +29,7 @@ class AbstractProxyTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
$this->proxy = new ConcreteProxy();
|
||||
$this->proxy = $this->getMockForAbstractClass(AbstractProxy::class);
|
||||
}
|
||||
|
||||
protected function tearDown()
|
||||
@@ -76,7 +45,7 @@ class AbstractProxyTest extends \PHPUnit_Framework_TestCase
|
||||
public function testIsSessionHandlerInterface()
|
||||
{
|
||||
$this->assertFalse($this->proxy->isSessionHandlerInterface());
|
||||
$sh = new ConcreteSessionHandlerInterfaceProxy();
|
||||
$sh = new SessionHandlerProxy(new \SessionHandler());
|
||||
$this->assertTrue($sh->isSessionHandlerInterface());
|
||||
}
|
||||
|
||||
|
@@ -11,14 +11,17 @@
|
||||
|
||||
namespace Symfony\Component\HttpFoundation\Tests\Session\Storage\Proxy;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\HttpFoundation\Session\Storage\Proxy\NativeProxy;
|
||||
|
||||
/**
|
||||
* Test class for NativeProxy.
|
||||
*
|
||||
* @group legacy
|
||||
*
|
||||
* @author Drak <drak@zikula.org>
|
||||
*/
|
||||
class NativeProxyTest extends \PHPUnit_Framework_TestCase
|
||||
class NativeProxyTest extends TestCase
|
||||
{
|
||||
public function testIsWrapper()
|
||||
{
|
||||
|
@@ -11,6 +11,7 @@
|
||||
|
||||
namespace Symfony\Component\HttpFoundation\Tests\Session\Storage\Proxy;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy;
|
||||
|
||||
/**
|
||||
@@ -21,7 +22,7 @@ use Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy;
|
||||
* @runTestsInSeparateProcesses
|
||||
* @preserveGlobalState disabled
|
||||
*/
|
||||
class SessionHandlerProxyTest extends \PHPUnit_Framework_TestCase
|
||||
class SessionHandlerProxyTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @var \PHPUnit_Framework_MockObject_Matcher
|
||||
@@ -35,7 +36,7 @@ class SessionHandlerProxyTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
$this->mock = $this->getMock('SessionHandlerInterface');
|
||||
$this->mock = $this->getMockBuilder('SessionHandlerInterface')->getMock();
|
||||
$this->proxy = new SessionHandlerProxy($this->mock);
|
||||
}
|
||||
|
||||
@@ -120,4 +121,37 @@ class SessionHandlerProxyTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
$this->proxy->gc(86400);
|
||||
}
|
||||
|
||||
/**
|
||||
* @requires PHPUnit 5.1
|
||||
*/
|
||||
public function testValidateId()
|
||||
{
|
||||
$mock = $this->getMockBuilder(array('SessionHandlerInterface', 'SessionUpdateTimestampHandlerInterface'))->getMock();
|
||||
$mock->expects($this->once())
|
||||
->method('validateId');
|
||||
|
||||
$proxy = new SessionHandlerProxy($mock);
|
||||
$proxy->validateId('id');
|
||||
|
||||
$this->assertTrue($this->proxy->validateId('id'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @requires PHPUnit 5.1
|
||||
*/
|
||||
public function testUpdateTimestamp()
|
||||
{
|
||||
$mock = $this->getMockBuilder(array('SessionHandlerInterface', 'SessionUpdateTimestampHandlerInterface'))->getMock();
|
||||
$mock->expects($this->once())
|
||||
->method('updateTimestamp');
|
||||
|
||||
$proxy = new SessionHandlerProxy($mock);
|
||||
$proxy->updateTimestamp('id', 'data');
|
||||
|
||||
$this->mock->expects($this->once())
|
||||
->method('write');
|
||||
|
||||
$this->proxy->updateTimestamp('id', 'data');
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user