From d19d6533dd8061f130e50fc55943cdcebc923fdd Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 19 May 2016 08:56:47 +0200 Subject: [PATCH] Fix public/ namespace in tests --- .../ContactsTest.php} | 30 ++++++++++--------- .../OCPConfigTest.php} | 4 ++- .../util.php => publicnamespace/UtilTest.php} | 7 +++-- 3 files changed, 24 insertions(+), 17 deletions(-) rename tests/lib/{public/contacts.php => publicnamespace/ContactsTest.php} (84%) rename tests/lib/{public/ocpconfig.php => publicnamespace/OCPConfigTest.php} (93%) rename tests/lib/{public/util.php => publicnamespace/UtilTest.php} (92%) diff --git a/tests/lib/public/contacts.php b/tests/lib/publicnamespace/ContactsTest.php similarity index 84% rename from tests/lib/public/contacts.php rename to tests/lib/publicnamespace/ContactsTest.php index 151e98d390..8b07c4831b 100644 --- a/tests/lib/public/contacts.php +++ b/tests/lib/publicnamespace/ContactsTest.php @@ -19,15 +19,17 @@ * License along with this library. If not, see . */ -class Test_Contacts extends \Test\TestCase { +namespace Test\PublicNamespace; + +class ContactsTest extends \Test\TestCase { protected function setUp() { parent::setUp(); - OCP\Contacts::clear(); + \OCP\Contacts::clear(); } public function testDisabledIfEmpty() { // pretty simple - $this->assertFalse(OCP\Contacts::isEnabled()); + $this->assertFalse(\OCP\Contacts::isEnabled()); } public function testEnabledAfterRegister() { @@ -41,19 +43,19 @@ class Test_Contacts extends \Test\TestCase { ->method('getKey'); // not enabled before register - $this->assertFalse(OCP\Contacts::isEnabled()); + $this->assertFalse(\OCP\Contacts::isEnabled()); // register the address book - OCP\Contacts::registerAddressBook($stub); + \OCP\Contacts::registerAddressBook($stub); // contacts api shall be enabled - $this->assertTrue(OCP\Contacts::isEnabled()); + $this->assertTrue(\OCP\Contacts::isEnabled()); // unregister the address book - OCP\Contacts::unregisterAddressBook($stub); + \OCP\Contacts::unregisterAddressBook($stub); // not enabled after register - $this->assertFalse(OCP\Contacts::isEnabled()); + $this->assertFalse(\OCP\Contacts::isEnabled()); } public function testAddressBookEnumeration() { @@ -69,8 +71,8 @@ class Test_Contacts extends \Test\TestCase { ->will($this->returnValue('A very simple Addressbook')); // register the address book - OCP\Contacts::registerAddressBook($stub); - $all_books = OCP\Contacts::getAddressBooks(); + \OCP\Contacts::registerAddressBook($stub); + $all_books = \OCP\Contacts::getAddressBooks(); $this->assertEquals(1, count($all_books)); $this->assertEquals('A very simple Addressbook', $all_books['SIMPLE_ADDRESS_BOOK']); @@ -101,15 +103,15 @@ class Test_Contacts extends \Test\TestCase { $stub2->expects($this->any())->method('search')->will($this->returnValue($searchResult2)); // register the address books - OCP\Contacts::registerAddressBook($stub1); - OCP\Contacts::registerAddressBook($stub2); - $all_books = OCP\Contacts::getAddressBooks(); + \OCP\Contacts::registerAddressBook($stub1); + \OCP\Contacts::registerAddressBook($stub2); + $all_books = \OCP\Contacts::getAddressBooks(); // assert the count - doesn't hurt $this->assertEquals(2, count($all_books)); // perform the search - $result = OCP\Contacts::search('x', array()); + $result = \OCP\Contacts::search('x', array()); // we expect 4 hits $this->assertEquals(4, count($result)); diff --git a/tests/lib/public/ocpconfig.php b/tests/lib/publicnamespace/OCPConfigTest.php similarity index 93% rename from tests/lib/public/ocpconfig.php rename to tests/lib/publicnamespace/OCPConfigTest.php index 947d2b3c9e..44fd234735 100644 --- a/tests/lib/public/ocpconfig.php +++ b/tests/lib/publicnamespace/OCPConfigTest.php @@ -19,7 +19,9 @@ * License along with this library. If not, see . */ -class Test_OCPConfig extends \Test\TestCase { +namespace Test\PublicNamespace; + +class OCPConfigTest extends \Test\TestCase { public function testSetAppValueIfSetToNull() { diff --git a/tests/lib/public/util.php b/tests/lib/publicnamespace/UtilTest.php similarity index 92% rename from tests/lib/public/util.php rename to tests/lib/publicnamespace/UtilTest.php index ebc4f70079..31d1f9fb0e 100644 --- a/tests/lib/public/util.php +++ b/tests/lib/publicnamespace/UtilTest.php @@ -19,10 +19,13 @@ * License along with this library. If not, see . */ -class Test_Public_Util extends \Test\TestCase { +namespace Test\PublicNamespace; + + +class UtilTest extends \Test\TestCase { protected function setUp() { parent::setUp(); - OCP\Contacts::clear(); + \OCP\Contacts::clear(); } /**