diff options
author | Lukas Reschke <lukas@statuscode.ch> | 2017-04-11 14:39:46 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-11 14:39:46 +0200 |
commit | afb5d45705f7d7743b9dfd2d79b618938cb05b77 (patch) | |
tree | a0828097cae435e504350d6aae0bbca56f40435c /tests | |
parent | 5ca5ebe584999d6dbc4b363bb285c8ae00c1b5f2 (diff) | |
parent | d83c8e02718f5ae555e75d8582904611a4d6766a (diff) | |
download | nextcloud-server-afb5d45705f7d7743b9dfd2d79b618938cb05b77.tar.gz nextcloud-server-afb5d45705f7d7743b9dfd2d79b618938cb05b77.zip |
Merge pull request #4256 from nextcloud/theming
Move OC_Defaults to OCP\Defaults
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Core/Controller/LostControllerTest.php | 6 | ||||
-rw-r--r-- | tests/Settings/Controller/UsersControllerTest.php | 2 | ||||
-rw-r--r-- | tests/Settings/Mailer/NewUserMailHelperTest.php | 21 | ||||
-rw-r--r-- | tests/data/emails/new-account-email-custom.html | 2 | ||||
-rw-r--r-- | tests/data/emails/new-account-email.html | 2 | ||||
-rw-r--r-- | tests/lib/Accounts/AccountsManagerTest.php | 1 | ||||
-rw-r--r-- | tests/lib/Mail/EMailTemplateTest.php | 14 | ||||
-rw-r--r-- | tests/lib/Mail/MailerTest.php | 6 | ||||
-rw-r--r-- | tests/lib/SetupTest.php | 17 | ||||
-rw-r--r-- | tests/lib/Template/SCSSCacherTest.php | 2 | ||||
-rw-r--r-- | tests/lib/TestCase.php | 12 |
11 files changed, 38 insertions, 47 deletions
diff --git a/tests/Core/Controller/LostControllerTest.php b/tests/Core/Controller/LostControllerTest.php index 255c6ace359..c8b8f87e73b 100644 --- a/tests/Core/Controller/LostControllerTest.php +++ b/tests/Core/Controller/LostControllerTest.php @@ -23,9 +23,9 @@ namespace Tests\Core\Controller; use OC\Core\Controller\LostController; use OC\Mail\Message; -use OCA\Encryption\Exceptions\PrivateKeyMissingException; use OCP\AppFramework\Http\TemplateResponse; use OCP\AppFramework\Utility\ITimeFactory; +use OCP\Defaults; use OCP\Encryption\IManager; use OCP\IConfig; use OCP\IL10N; @@ -55,7 +55,7 @@ class LostControllerTest extends \Test\TestCase { private $l10n; /** @var IUserManager | PHPUnit_Framework_MockObject_MockObject */ private $userManager; - /** @var \OC_Defaults */ + /** @var Defaults */ private $defaults; /** @var IConfig | PHPUnit_Framework_MockObject_MockObject */ private $config; @@ -94,7 +94,7 @@ class LostControllerTest extends \Test\TestCase { ->will($this->returnCallback(function($text, $parameters = array()) { return vsprintf($text, $parameters); })); - $this->defaults = $this->getMockBuilder('\OC_Defaults') + $this->defaults = $this->getMockBuilder('\OCP\Defaults') ->disableOriginalConstructor()->getMock(); $this->userManager = $this->getMockBuilder('\OCP\IUserManager') ->disableOriginalConstructor()->getMock(); diff --git a/tests/Settings/Controller/UsersControllerTest.php b/tests/Settings/Controller/UsersControllerTest.php index d7961e2332b..79e6dd61813 100644 --- a/tests/Settings/Controller/UsersControllerTest.php +++ b/tests/Settings/Controller/UsersControllerTest.php @@ -52,8 +52,6 @@ class UsersControllerTest extends \Test\TestCase { private $config; /** @var ILogger|\PHPUnit_Framework_MockObject_MockObject */ private $logger; - /** @var \OC_Defaults|\PHPUnit_Framework_MockObject_MockObject */ - private $defaults; /** @var IMailer|\PHPUnit_Framework_MockObject_MockObject */ private $mailer; /** @var IURLGenerator|\PHPUnit_Framework_MockObject_MockObject */ diff --git a/tests/Settings/Mailer/NewUserMailHelperTest.php b/tests/Settings/Mailer/NewUserMailHelperTest.php index e77e8e197b8..f38eed0745e 100644 --- a/tests/Settings/Mailer/NewUserMailHelperTest.php +++ b/tests/Settings/Mailer/NewUserMailHelperTest.php @@ -21,12 +21,11 @@ namespace Tests\Settings\Mailer; -use OC\Mail\EMailTemplate; use OC\Mail\IEMailTemplate; use OC\Mail\Message; use OC\Settings\Mailer\NewUserMailHelper; -use OCA\Theming\ThemingDefaults; use OCP\AppFramework\Utility\ITimeFactory; +use OCP\Defaults; use OCP\IConfig; use OCP\IL10N; use OCP\IURLGenerator; @@ -37,8 +36,8 @@ use OCP\Security\ISecureRandom; use Test\TestCase; class NewUserMailHelperTest extends TestCase { - /** @var ThemingDefaults|\PHPUnit_Framework_MockObject_MockObject */ - private $themingDefaults; + /** @var Defaults|\PHPUnit_Framework_MockObject_MockObject */ + private $defaults; /** @var IURLGenerator|\PHPUnit_Framework_MockObject_MockObject */ private $urlGenerator; /** @var IL10N|\PHPUnit_Framework_MockObject_MockObject */ @@ -59,7 +58,7 @@ class NewUserMailHelperTest extends TestCase { public function setUp() { parent::setUp(); - $this->themingDefaults = $this->createMock(ThemingDefaults::class); + $this->defaults = $this->createMock(Defaults::class); $this->urlGenerator = $this->createMock(IURLGenerator::class); $this->l10n = $this->createMock(IL10N::class); $this->mailer = $this->createMock(IMailer::class); @@ -73,7 +72,7 @@ class NewUserMailHelperTest extends TestCase { })); $this->newUserMailHelper = new NewUserMailHelper( - $this->themingDefaults, + $this->defaults, $this->urlGenerator, $this->l10n, $this->mailer, @@ -144,7 +143,7 @@ class NewUserMailHelperTest extends TestCase { ->expects($this->at(5)) ->method('getUID') ->willReturn('john'); - $this->themingDefaults + $this->defaults ->expects($this->at(0)) ->method('getName') ->willReturn('TestCloud'); @@ -175,7 +174,7 @@ class NewUserMailHelperTest extends TestCase { <tbody> <tr style="padding:0;text-align:left;vertical-align:top"> <center data-parsed="" style="min-width:580px;width:100%"> - <img class="logo float-center" src="?v=" alt="logo" align="center" style="-ms-interpolation-mode:bicubic;Margin:0 auto;clear:both;display:block;float:none;margin:0 auto;max-height:100%;max-width:100px;outline:0;text-align:center;text-decoration:none;width:auto"> + <img class="logo float-center" src="" alt="logo" align="center" style="-ms-interpolation-mode:bicubic;Margin:0 auto;clear:both;display:block;float:none;margin:0 auto;max-height:100%;max-width:100px;outline:0;text-align:center;text-decoration:none;width:auto"> </center> </tr> </tbody> @@ -376,7 +375,7 @@ EOF; ->expects($this->at(1)) ->method('getUID') ->willReturn('john'); - $this->themingDefaults + $this->defaults ->expects($this->any()) ->method('getName') ->willReturn('TestCloud'); @@ -407,7 +406,7 @@ EOF; <tbody> <tr style="padding:0;text-align:left;vertical-align:top"> <center data-parsed="" style="min-width:580px;width:100%"> - <img class="logo float-center" src="?v=" alt="logo" align="center" style="-ms-interpolation-mode:bicubic;Margin:0 auto;clear:both;display:block;float:none;margin:0 auto;max-height:100%;max-width:100px;outline:0;text-align:center;text-decoration:none;width:auto"> + <img class="logo float-center" src="" alt="logo" align="center" style="-ms-interpolation-mode:bicubic;Margin:0 auto;clear:both;display:block;float:none;margin:0 auto;max-height:100%;max-width:100px;outline:0;text-align:center;text-decoration:none;width:auto"> </center> </tr> </tbody> @@ -609,7 +608,7 @@ EOF; ->expects($this->at(0)) ->method('setTo') ->with(['recipient@example.com' => 'John Doe']); - $this->themingDefaults + $this->defaults ->expects($this->exactly(2)) ->method('getName') ->willReturn('TestCloud'); diff --git a/tests/data/emails/new-account-email-custom.html b/tests/data/emails/new-account-email-custom.html index 10d3330604d..c754412e681 100644 --- a/tests/data/emails/new-account-email-custom.html +++ b/tests/data/emails/new-account-email-custom.html @@ -23,7 +23,7 @@ <tbody> <tr style="padding:0;text-align:left;vertical-align:top"> <center data-parsed="" style="min-width:580px;width:100%"> - <img class="logo float-center" src="https://example.org/img/logo-mail-header.png?v=48" alt="logo" align="center" style="-ms-interpolation-mode:bicubic;Margin:0 auto;clear:both;display:block;float:none;margin:0 auto;max-height:100%;max-width:100px;outline:0;text-align:center;text-decoration:none;width:auto"> + <img class="logo float-center" src="https://example.org/img/logo-mail-header.png" alt="logo" align="center" style="-ms-interpolation-mode:bicubic;Margin:0 auto;clear:both;display:block;float:none;margin:0 auto;max-height:100%;max-width:100px;outline:0;text-align:center;text-decoration:none;width:auto"> </center> </tr> </tbody> diff --git a/tests/data/emails/new-account-email.html b/tests/data/emails/new-account-email.html index a32ad61c49c..4fb6f5af15e 100644 --- a/tests/data/emails/new-account-email.html +++ b/tests/data/emails/new-account-email.html @@ -23,7 +23,7 @@ <tbody> <tr style="padding:0;text-align:left;vertical-align:top"> <center data-parsed="" style="min-width:580px;width:100%"> - <img class="logo float-center" src="https://example.org/img/logo-mail-header.png?v=48" alt="logo" align="center" style="-ms-interpolation-mode:bicubic;Margin:0 auto;clear:both;display:block;float:none;margin:0 auto;max-height:100%;max-width:100px;outline:0;text-align:center;text-decoration:none;width:auto"> + <img class="logo float-center" src="https://example.org/img/logo-mail-header.png" alt="logo" align="center" style="-ms-interpolation-mode:bicubic;Margin:0 auto;clear:both;display:block;float:none;margin:0 auto;max-height:100%;max-width:100px;outline:0;text-align:center;text-decoration:none;width:auto"> </center> </tr> </tbody> diff --git a/tests/lib/Accounts/AccountsManagerTest.php b/tests/lib/Accounts/AccountsManagerTest.php index c0e20164908..e6c1552fdc0 100644 --- a/tests/lib/Accounts/AccountsManagerTest.php +++ b/tests/lib/Accounts/AccountsManagerTest.php @@ -24,7 +24,6 @@ namespace Test\Accounts; use OC\Accounts\AccountManager; -use OC\Mail\Mailer; use OCP\IUser; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\EventDispatcher\GenericEvent; diff --git a/tests/lib/Mail/EMailTemplateTest.php b/tests/lib/Mail/EMailTemplateTest.php index 47fe09aabbb..ab90dc4aa07 100644 --- a/tests/lib/Mail/EMailTemplateTest.php +++ b/tests/lib/Mail/EMailTemplateTest.php @@ -24,13 +24,13 @@ namespace Test\Mail; use OC\Mail\EMailTemplate; -use OCA\Theming\ThemingDefaults; +use OCP\Defaults; use OCP\IL10N; use OCP\IURLGenerator; use Test\TestCase; class EMailTemplateTest extends TestCase { - /** @var ThemingDefaults|\PHPUnit_Framework_MockObject_MockObject */ + /** @var Defaults|\PHPUnit_Framework_MockObject_MockObject */ private $defaults; /** @var IURLGenerator|\PHPUnit_Framework_MockObject_MockObject */ private $urlGenerator; @@ -42,7 +42,7 @@ class EMailTemplateTest extends TestCase { public function setUp() { parent::setUp(); - $this->defaults = $this->createMock(ThemingDefaults::class); + $this->defaults = $this->createMock(Defaults::class); $this->urlGenerator = $this->createMock(IURLGenerator::class); $this->l10n = $this->createMock(IL10N::class); @@ -62,10 +62,6 @@ class EMailTemplateTest extends TestCase { ->expects($this->any()) ->method('getLogo') ->willReturn('/img/logo-mail-header.png'); - $this->defaults - ->expects($this->any()) - ->method('getCacheBusterCounter') - ->willReturn('48'); $this->urlGenerator ->expects($this->once()) ->method('getAbsoluteURL') @@ -107,10 +103,6 @@ class EMailTemplateTest extends TestCase { ->expects($this->any()) ->method('getLogo') ->willReturn('/img/logo-mail-header.png'); - $this->defaults - ->expects($this->any()) - ->method('getCacheBusterCounter') - ->willReturn('48'); $this->urlGenerator ->expects($this->once()) ->method('getAbsoluteURL') diff --git a/tests/lib/Mail/MailerTest.php b/tests/lib/Mail/MailerTest.php index 7a7ce0392e9..02f7bdc6589 100644 --- a/tests/lib/Mail/MailerTest.php +++ b/tests/lib/Mail/MailerTest.php @@ -9,15 +9,15 @@ namespace Test\Mail; use OC\Mail\Mailer; +use OCP\Defaults; use OCP\IConfig; -use OC_Defaults; use OCP\ILogger; use Test\TestCase; class MailerTest extends TestCase { /** @var IConfig */ private $config; - /** @var OC_Defaults */ + /** @var Defaults */ private $defaults; /** @var ILogger */ private $logger; @@ -29,7 +29,7 @@ class MailerTest extends TestCase { $this->config = $this->getMockBuilder('\OCP\IConfig') ->disableOriginalConstructor()->getMock(); - $this->defaults = $this->getMockBuilder('\OC_Defaults') + $this->defaults = $this->getMockBuilder('\OCP\Defaults') ->disableOriginalConstructor()->getMock(); $this->logger = $this->getMockBuilder('\OCP\ILogger') ->disableOriginalConstructor()->getMock(); diff --git a/tests/lib/SetupTest.php b/tests/lib/SetupTest.php index d0e38cf407f..78c35a5b0bb 100644 --- a/tests/lib/SetupTest.php +++ b/tests/lib/SetupTest.php @@ -10,25 +10,26 @@ namespace Test; use bantu\IniGetWrapper\IniGetWrapper; use OC\SystemConfig; +use OCP\Defaults; use OCP\IL10N; use OCP\ILogger; use OCP\Security\ISecureRandom; class SetupTest extends \Test\TestCase { - /** @var SystemConfig | \PHPUnit_Framework_MockObject_MockObject */ + /** @var SystemConfig|\PHPUnit_Framework_MockObject_MockObject */ protected $config; - /** @var \bantu\IniGetWrapper\IniGetWrapper | \PHPUnit_Framework_MockObject_MockObject */ + /** @var \bantu\IniGetWrapper\IniGetWrapper|\PHPUnit_Framework_MockObject_MockObject */ private $iniWrapper; - /** @var \OCP\IL10N | \PHPUnit_Framework_MockObject_MockObject */ + /** @var \OCP\IL10N|\PHPUnit_Framework_MockObject_MockObject */ private $l10n; - /** @var \OC_Defaults | \PHPUnit_Framework_MockObject_MockObject */ + /** @var Defaults|\PHPUnit_Framework_MockObject_MockObject */ private $defaults; - /** @var \OC\Setup | \PHPUnit_Framework_MockObject_MockObject */ + /** @var \OC\Setup|\PHPUnit_Framework_MockObject_MockObject */ protected $setupClass; - /** @var \OCP\ILogger | \PHPUnit_Framework_MockObject_MockObject */ + /** @var \OCP\ILogger|\PHPUnit_Framework_MockObject_MockObject */ protected $logger; - /** @var \OCP\Security\ISecureRandom | \PHPUnit_Framework_MockObject_MockObject */ + /** @var \OCP\Security\ISecureRandom|\PHPUnit_Framework_MockObject_MockObject */ protected $random; protected function setUp() { @@ -37,7 +38,7 @@ class SetupTest extends \Test\TestCase { $this->config = $this->createMock(SystemConfig::class); $this->iniWrapper = $this->createMock(IniGetWrapper::class); $this->l10n = $this->createMock(IL10N::class); - $this->defaults = $this->createMock(\OC_Defaults::class); + $this->defaults = $this->createMock(Defaults::class); $this->logger = $this->createMock(ILogger::class); $this->random = $this->createMock(ISecureRandom::class); $this->setupClass = $this->getMockBuilder('\OC\Setup') diff --git a/tests/lib/Template/SCSSCacherTest.php b/tests/lib/Template/SCSSCacherTest.php index 24865b9ae45..08084e68382 100644 --- a/tests/lib/Template/SCSSCacherTest.php +++ b/tests/lib/Template/SCSSCacherTest.php @@ -42,8 +42,6 @@ class SCSSCacherTest extends \Test\TestCase { protected $urlGenerator; /** @var IConfig|\PHPUnit_Framework_MockObject_MockObject */ protected $config; - /** @var \OC_Defaults|\PHPUnit_Framework_MockObject_MockObject */ - protected $defaults; /** @var SCSSCacher */ protected $scssCacher; /** @var ICache|\PHPUnit_Framework_MockObject_MockObject */ diff --git a/tests/lib/TestCase.php b/tests/lib/TestCase.php index 23a66f73ec7..c3aa2c73c9e 100644 --- a/tests/lib/TestCase.php +++ b/tests/lib/TestCase.php @@ -24,12 +24,11 @@ namespace Test; use DOMDocument; use DOMNode; -use OC\Cache\CappedMemoryCache; use OC\Command\QueueBus; use OC\Files\Filesystem; use OC\Template\Base; -use OC_Defaults; use OCP\DB\QueryBuilder\IQueryBuilder; +use OCP\Defaults; use OCP\IDBConnection; use OCP\IL10N; use OCP\Security\ISecureRandom; @@ -483,8 +482,13 @@ abstract class TestCase extends \PHPUnit_Framework_TestCase { require_once __DIR__.'/../../lib/private/legacy/template/functions.php'; $requestToken = 12345; - $theme = new OC_Defaults(); - /** @var IL10N | \PHPUnit_Framework_MockObject_MockObject $l10n */ + /** @var Defaults|\PHPUnit_Framework_MockObject_MockObject $l10n */ + $theme = $this->getMockBuilder('\OCP\Defaults') + ->disableOriginalConstructor()->getMock(); + $theme->expects($this->any()) + ->method('getName') + ->willReturn('Nextcloud'); + /** @var IL10N|\PHPUnit_Framework_MockObject_MockObject $l10n */ $l10n = $this->getMockBuilder('\OCP\IL10N') ->disableOriginalConstructor()->getMock(); $l10n |