diff options
author | Morris Jobke <hey@morrisjobke.de> | 2017-04-07 15:42:43 -0500 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2017-04-09 21:43:01 -0500 |
commit | 5b4adf66e51e21b3ecbd683397a362b60f792a50 (patch) | |
tree | 8bdc129ac9fd6575ee41be438ff667e49f7110a2 /tests/lib | |
parent | ca9d25169dcdd2923a356e2a797d8704506a3787 (diff) | |
download | nextcloud-server-5b4adf66e51e21b3ecbd683397a362b60f792a50.tar.gz nextcloud-server-5b4adf66e51e21b3ecbd683397a362b60f792a50.zip |
Move OC_Defaults to OCP\Defaults
* currently there are two ways to access default values:
OCP\Defaults or OC_Defaults (which is extended by
OCA\Theming\ThemingDefaults)
* our code used a mixture of both of them, which made
it hard to work on theme values
* this extended the public interface with the missing
methods and uses them everywhere to only rely on the
public interface
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
Diffstat (limited to 'tests/lib')
-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 |
6 files changed, 23 insertions, 29 deletions
diff --git a/tests/lib/Accounts/AccountsManagerTest.php b/tests/lib/Accounts/AccountsManagerTest.php index 60811140e72..84ffa47e35e 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 Test\TestCase; 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 |