Fix unit tests for BlockLegacyClientPlugin
This commit is contained in:
parent
1c39b30d50
commit
9df3869bfc
|
@ -26,6 +26,7 @@
|
|||
namespace OCA\DAV\Tests\unit\Connector\Sabre;
|
||||
|
||||
use OCA\DAV\Connector\Sabre\BlockLegacyClientPlugin;
|
||||
use PHPUnit_Framework_MockObject_MockObject;
|
||||
use Test\TestCase;
|
||||
use OCP\IConfig;
|
||||
|
||||
|
@ -35,7 +36,7 @@ use OCP\IConfig;
|
|||
* @package OCA\DAV\Tests\unit\Connector\Sabre
|
||||
*/
|
||||
class BlockLegacyClientPluginTest extends TestCase {
|
||||
/** @var IConfig */
|
||||
/** @var IConfig | \PHPUnit_Framework_MockObject_MockObject */
|
||||
private $config;
|
||||
/** @var BlockLegacyClientPlugin */
|
||||
private $blockLegacyClientVersionPlugin;
|
||||
|
@ -69,10 +70,8 @@ class BlockLegacyClientPluginTest extends TestCase {
|
|||
* @expectedExceptionMessage Unsupported client version.
|
||||
*/
|
||||
public function testBeforeHandlerException($userAgent) {
|
||||
/** @var \Sabre\HTTP\RequestInterface $request */
|
||||
$request = $this->getMockBuilder('\Sabre\HTTP\RequestInterface')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
/** @var \Sabre\HTTP\RequestInterface | PHPUnit_Framework_MockObject_MockObject $request */
|
||||
$request = $this->createMock('\Sabre\HTTP\RequestInterface');
|
||||
$request
|
||||
->expects($this->once())
|
||||
->method('getHeader')
|
||||
|
@ -82,7 +81,7 @@ class BlockLegacyClientPluginTest extends TestCase {
|
|||
$this->config
|
||||
->expects($this->once())
|
||||
->method('getSystemValue')
|
||||
->with('minimum.supported.desktop.version', '1.7.0')
|
||||
->with('minimum.supported.desktop.version', '2.0.0')
|
||||
->will($this->returnValue('1.7.0'));
|
||||
|
||||
$this->blockLegacyClientVersionPlugin->beforeHandler($request);
|
||||
|
@ -106,10 +105,8 @@ class BlockLegacyClientPluginTest extends TestCase {
|
|||
* @param string $userAgent
|
||||
*/
|
||||
public function testBeforeHandlerSuccess($userAgent) {
|
||||
/** @var \Sabre\HTTP\RequestInterface $request */
|
||||
$request = $this->getMockBuilder('\Sabre\HTTP\RequestInterface')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
/** @var \Sabre\HTTP\RequestInterface | PHPUnit_Framework_MockObject_MockObject $request */
|
||||
$request = $this->createMock('\Sabre\HTTP\RequestInterface');
|
||||
$request
|
||||
->expects($this->once())
|
||||
->method('getHeader')
|
||||
|
@ -119,17 +116,15 @@ class BlockLegacyClientPluginTest extends TestCase {
|
|||
$this->config
|
||||
->expects($this->once())
|
||||
->method('getSystemValue')
|
||||
->with('minimum.supported.desktop.version', '1.7.0')
|
||||
->with('minimum.supported.desktop.version', '2.0.0')
|
||||
->will($this->returnValue('1.7.0'));
|
||||
|
||||
$this->blockLegacyClientVersionPlugin->beforeHandler($request);
|
||||
}
|
||||
|
||||
public function testBeforeHandlerNoUserAgent() {
|
||||
/** @var \Sabre\HTTP\RequestInterface $request */
|
||||
$request = $this->getMockBuilder('\Sabre\HTTP\RequestInterface')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
/** @var \Sabre\HTTP\RequestInterface | PHPUnit_Framework_MockObject_MockObject $request */
|
||||
$request = $this->createMock('\Sabre\HTTP\RequestInterface');
|
||||
$request
|
||||
->expects($this->once())
|
||||
->method('getHeader')
|
||||
|
|
Loading…
Reference in New Issue