Fix getMock UrlGeneratortest
This commit is contained in:
parent
2f36bbecb8
commit
478b86e5e5
|
@ -7,6 +7,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Test;
|
namespace Test;
|
||||||
|
use OCP\ICacheFactory;
|
||||||
|
use OCP\IConfig;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class UrlGeneratorTest
|
* Class UrlGeneratorTest
|
||||||
|
@ -22,8 +24,8 @@ class UrlGeneratorTest extends \Test\TestCase {
|
||||||
*/
|
*/
|
||||||
public function testLinkToDocRoot($app, $file, $args, $expectedResult) {
|
public function testLinkToDocRoot($app, $file, $args, $expectedResult) {
|
||||||
\OC::$WEBROOT = '';
|
\OC::$WEBROOT = '';
|
||||||
$config = $this->getMock('\OCP\IConfig');
|
$config = $this->createMock(IConfig::class);
|
||||||
$cacheFactory = $this->getMock('\OCP\ICacheFactory');
|
$cacheFactory = $this->createMock(ICacheFactory::class);
|
||||||
$urlGenerator = new \OC\URLGenerator($config, $cacheFactory);
|
$urlGenerator = new \OC\URLGenerator($config, $cacheFactory);
|
||||||
$result = $urlGenerator->linkTo($app, $file, $args);
|
$result = $urlGenerator->linkTo($app, $file, $args);
|
||||||
|
|
||||||
|
@ -37,8 +39,8 @@ class UrlGeneratorTest extends \Test\TestCase {
|
||||||
*/
|
*/
|
||||||
public function testLinkToSubDir($app, $file, $args, $expectedResult) {
|
public function testLinkToSubDir($app, $file, $args, $expectedResult) {
|
||||||
\OC::$WEBROOT = '/owncloud';
|
\OC::$WEBROOT = '/owncloud';
|
||||||
$config = $this->getMock('\OCP\IConfig');
|
$config = $this->createMock(IConfig::class);
|
||||||
$cacheFactory = $this->getMock('\OCP\ICacheFactory');
|
$cacheFactory = $this->createMock(ICacheFactory::class);
|
||||||
$urlGenerator = new \OC\URLGenerator($config, $cacheFactory);
|
$urlGenerator = new \OC\URLGenerator($config, $cacheFactory);
|
||||||
$result = $urlGenerator->linkTo($app, $file, $args);
|
$result = $urlGenerator->linkTo($app, $file, $args);
|
||||||
|
|
||||||
|
@ -50,8 +52,8 @@ class UrlGeneratorTest extends \Test\TestCase {
|
||||||
*/
|
*/
|
||||||
public function testLinkToRouteAbsolute($route, $expected) {
|
public function testLinkToRouteAbsolute($route, $expected) {
|
||||||
\OC::$WEBROOT = '/owncloud';
|
\OC::$WEBROOT = '/owncloud';
|
||||||
$config = $this->getMock('\OCP\IConfig');
|
$config = $this->createMock(IConfig::class);
|
||||||
$cacheFactory = $this->getMock('\OCP\ICacheFactory');
|
$cacheFactory = $this->createMock(ICacheFactory::class);
|
||||||
$urlGenerator = new \OC\URLGenerator($config, $cacheFactory);
|
$urlGenerator = new \OC\URLGenerator($config, $cacheFactory);
|
||||||
$result = $urlGenerator->linkToRouteAbsolute($route);
|
$result = $urlGenerator->linkToRouteAbsolute($route);
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
|
@ -89,8 +91,8 @@ class UrlGeneratorTest extends \Test\TestCase {
|
||||||
function testGetAbsoluteURLDocRoot($url, $expectedResult) {
|
function testGetAbsoluteURLDocRoot($url, $expectedResult) {
|
||||||
|
|
||||||
\OC::$WEBROOT = '';
|
\OC::$WEBROOT = '';
|
||||||
$config = $this->getMock('\OCP\IConfig');
|
$config = $this->createMock(IConfig::class);
|
||||||
$cacheFactory = $this->getMock('\OCP\ICacheFactory');
|
$cacheFactory = $this->createMock(ICacheFactory::class);
|
||||||
$urlGenerator = new \OC\URLGenerator($config, $cacheFactory);
|
$urlGenerator = new \OC\URLGenerator($config, $cacheFactory);
|
||||||
$result = $urlGenerator->getAbsoluteURL($url);
|
$result = $urlGenerator->getAbsoluteURL($url);
|
||||||
|
|
||||||
|
@ -105,8 +107,8 @@ class UrlGeneratorTest extends \Test\TestCase {
|
||||||
function testGetAbsoluteURLSubDir($url, $expectedResult) {
|
function testGetAbsoluteURLSubDir($url, $expectedResult) {
|
||||||
|
|
||||||
\OC::$WEBROOT = '/owncloud';
|
\OC::$WEBROOT = '/owncloud';
|
||||||
$config = $this->getMock('\OCP\IConfig');
|
$config = $this->createMock(IConfig::class);
|
||||||
$cacheFactory = $this->getMock('\OCP\ICacheFactory');
|
$cacheFactory = $this->createMock(ICacheFactory::class);
|
||||||
$urlGenerator = new \OC\URLGenerator($config, $cacheFactory);
|
$urlGenerator = new \OC\URLGenerator($config, $cacheFactory);
|
||||||
$result = $urlGenerator->getAbsoluteURL($url);
|
$result = $urlGenerator->getAbsoluteURL($url);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue