diff options
author | Julius Haertl <jus@bitgrid.net> | 2017-02-09 22:51:05 +0100 |
---|---|---|
committer | Julius Haertl <jus@bitgrid.net> | 2017-02-16 15:13:39 +0100 |
commit | 3f0134622dafe01d1bed2c7d25d14da425e35fc4 (patch) | |
tree | 34472c976d708c32c575ac2f16796310361ed022 /apps/theming/tests | |
parent | b2cbe3530daa04451195865afc177bc6bde6c359 (diff) | |
download | nextcloud-server-3f0134622dafe01d1bed2c7d25d14da425e35fc4.tar.gz nextcloud-server-3f0134622dafe01d1bed2c7d25d14da425e35fc4.zip |
Use createMock
Signed-off-by: Julius Haertl <jus@bitgrid.net>
Diffstat (limited to 'apps/theming/tests')
-rw-r--r-- | apps/theming/tests/Controller/ThemingControllerTest.php | 55 | ||||
-rw-r--r-- | apps/theming/tests/Migration/ThemingImages.php | 16 |
2 files changed, 25 insertions, 46 deletions
diff --git a/apps/theming/tests/Controller/ThemingControllerTest.php b/apps/theming/tests/Controller/ThemingControllerTest.php index 0c47ac972b7..38cd8c96202 100644 --- a/apps/theming/tests/Controller/ThemingControllerTest.php +++ b/apps/theming/tests/Controller/ThemingControllerTest.php @@ -68,22 +68,19 @@ class ThemingControllerTest extends TestCase { private $appData; public function setUp() { - $this->request = $this->getMockBuilder(IRequest::class)->getMock(); - $this->config = $this->getMockBuilder(IConfig::class)->getMock(); - $this->template = $this->getMockBuilder(ThemingDefaults::class) - ->disableOriginalConstructor()->getMock(); - $this->timeFactory = $this->getMockBuilder(ITimeFactory::class) - ->disableOriginalConstructor() - ->getMock(); - $this->l10n = $this->getMockBuilder(L10N::class)->getMock(); - $this->rootFolder = $this->getMockBuilder(IRootFolder::class)->getMock(); - $this->appManager = $this->getMockBuilder(IAppManager::class)->getMock(); + $this->request = $this->createMock(IRequest::class); + $this->config = $this->createMock(IConfig::class); + $this->template = $this->createMock(ThemingDefaults::class); + $this->timeFactory = $this->createMock(ITimeFactory::class); + $this->l10n = $this->createMock(L10N::class); + $this->rootFolder = $this->createMock(IRootFolder::class); + $this->appManager = $this->createMock(IAppManager::class); $this->util = new Util($this->config, $this->rootFolder, $this->appManager); $this->timeFactory->expects($this->any()) ->method('getTime') ->willReturn(123); $this->tempManager = \OC::$server->getTempManager(); - $this->appData = $this->getMockBuilder(IAppData::class)->getMock(); + $this->appData = $this->createMock(IAppData::class); $this->themingController = new ThemingController( 'theming', @@ -200,12 +197,8 @@ class ThemingControllerTest extends TestCase { ->willReturn('Saved'); - $file = $this->getMockBuilder(ISimpleFile::class) - ->disableOriginalConstructor() - ->getMock(); - $folder = $this->getMockBuilder(ISimpleFolder::class) - ->disableOriginalConstructor() - ->getMock(); + $file = $this->createMock(ISimpleFile::class); + $folder = $this->createMock(ISimpleFolder::class); $this->appData ->expects($this->once()) ->method('getFolder') @@ -255,12 +248,8 @@ class ThemingControllerTest extends TestCase { ->with('Saved') ->willReturn('Saved'); - $file = $this->getMockBuilder(ISimpleFile::class) - ->disableOriginalConstructor() - ->getMock(); - $folder = $this->getMockBuilder(ISimpleFolder::class) - ->disableOriginalConstructor() - ->getMock(); + $file = $this->createMock(ISimpleFile::class); + $folder = $this->createMock(ISimpleFolder::class); $this->appData ->expects($this->once()) ->method('getFolder') @@ -309,9 +298,7 @@ class ThemingControllerTest extends TestCase { ->with('Unsupported image type') ->willReturn('Unsupported image type'); - $folder = $this->getMockBuilder(ISimpleFolder::class) - ->disableOriginalConstructor() - ->getMock(); + $folder = $this->createMock(ISimpleFolder::class); $this->appData ->expects($this->once()) ->method('getFolder') @@ -366,12 +353,8 @@ class ThemingControllerTest extends TestCase { } public function testGetLogo() { - $file = $this->getMockBuilder(ISimpleFile::class) - ->disableOriginalConstructor() - ->getMock(); - $folder = $this->getMockBuilder(ISimpleFolder::class) - ->disableOriginalConstructor() - ->getMock(); + $file = $this->createMock(ISimpleFile::class); + $folder = $this->createMock(ISimpleFolder::class); $this->appData ->expects($this->once()) ->method('getFolder') @@ -409,12 +392,8 @@ class ThemingControllerTest extends TestCase { } public function testGetLoginBackground() { - $file = $this->getMockBuilder(ISimpleFile::class) - ->disableOriginalConstructor() - ->getMock(); - $folder = $this->getMockBuilder(ISimpleFolder::class) - ->disableOriginalConstructor() - ->getMock(); + $file = $this->createMock(ISimpleFile::class); + $folder = $this->createMock(ISimpleFolder::class); $this->appData ->expects($this->once()) ->method('getFolder') diff --git a/apps/theming/tests/Migration/ThemingImages.php b/apps/theming/tests/Migration/ThemingImages.php index e5e3b1df5d3..e15d0fd1bbc 100644 --- a/apps/theming/tests/Migration/ThemingImages.php +++ b/apps/theming/tests/Migration/ThemingImages.php @@ -47,11 +47,11 @@ class ThemingImagesTest extends TestCase { public function setUp() { parent::setUp(); - $this->appData = $this->getMockBuilder(IAppData::class)->getMock(); - $this->rootFolder = $this->getMockBuilder(IRootFolder::class)->getMock(); + $this->appData = $this->createMock(IAppData::class); + $this->rootFolder = $this->createMock(IRootFolder::class); $this->repairStep = new ThemingImages($this->appData, $this->rootFolder); - $this->imageFolder = $this->getMockBuilder(ISimpleFolder::class)->getMock(); - $this->output = $this->getMockBuilder(IOutput::class)->getMock(); + $this->imageFolder = $this->createMock(ISimpleFolder::class); + $this->output = $this->createMock(IOutput::class); } public function testGetName() { @@ -76,8 +76,8 @@ class ThemingImagesTest extends TestCase { } public function testRunLogo() { - $oldFile = $this->getMockBuilder(File::class)->getMock(); - $newFile = $this->getMockBuilder(ISimpleFile::class)->getMock(); + $oldFile = $this->createMock(File::class); + $newFile = $this->createMock(ISimpleFile::class); $this->appData->expects($this->once()) ->method('newFolder') @@ -107,8 +107,8 @@ class ThemingImagesTest extends TestCase { } public function testRunBackground() { - $oldFile = $this->getMockBuilder(File::class)->getMock(); - $newFile = $this->getMockBuilder(ISimpleFile::class)->getMock(); + $oldFile = $this->createMock(File::class); + $newFile = $this->createMock(ISimpleFile::class); $this->appData->expects($this->once()) ->method('newFolder') |