Fix public/ namespace in tests
This commit is contained in:
parent
859d2bc0ff
commit
d19d6533dd
|
@ -19,15 +19,17 @@
|
||||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class Test_Contacts extends \Test\TestCase {
|
namespace Test\PublicNamespace;
|
||||||
|
|
||||||
|
class ContactsTest extends \Test\TestCase {
|
||||||
protected function setUp() {
|
protected function setUp() {
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
OCP\Contacts::clear();
|
\OCP\Contacts::clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testDisabledIfEmpty() {
|
public function testDisabledIfEmpty() {
|
||||||
// pretty simple
|
// pretty simple
|
||||||
$this->assertFalse(OCP\Contacts::isEnabled());
|
$this->assertFalse(\OCP\Contacts::isEnabled());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testEnabledAfterRegister() {
|
public function testEnabledAfterRegister() {
|
||||||
|
@ -41,19 +43,19 @@ class Test_Contacts extends \Test\TestCase {
|
||||||
->method('getKey');
|
->method('getKey');
|
||||||
|
|
||||||
// not enabled before register
|
// not enabled before register
|
||||||
$this->assertFalse(OCP\Contacts::isEnabled());
|
$this->assertFalse(\OCP\Contacts::isEnabled());
|
||||||
|
|
||||||
// register the address book
|
// register the address book
|
||||||
OCP\Contacts::registerAddressBook($stub);
|
\OCP\Contacts::registerAddressBook($stub);
|
||||||
|
|
||||||
// contacts api shall be enabled
|
// contacts api shall be enabled
|
||||||
$this->assertTrue(OCP\Contacts::isEnabled());
|
$this->assertTrue(\OCP\Contacts::isEnabled());
|
||||||
|
|
||||||
// unregister the address book
|
// unregister the address book
|
||||||
OCP\Contacts::unregisterAddressBook($stub);
|
\OCP\Contacts::unregisterAddressBook($stub);
|
||||||
|
|
||||||
// not enabled after register
|
// not enabled after register
|
||||||
$this->assertFalse(OCP\Contacts::isEnabled());
|
$this->assertFalse(\OCP\Contacts::isEnabled());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testAddressBookEnumeration() {
|
public function testAddressBookEnumeration() {
|
||||||
|
@ -69,8 +71,8 @@ class Test_Contacts extends \Test\TestCase {
|
||||||
->will($this->returnValue('A very simple Addressbook'));
|
->will($this->returnValue('A very simple Addressbook'));
|
||||||
|
|
||||||
// register the address book
|
// register the address book
|
||||||
OCP\Contacts::registerAddressBook($stub);
|
\OCP\Contacts::registerAddressBook($stub);
|
||||||
$all_books = OCP\Contacts::getAddressBooks();
|
$all_books = \OCP\Contacts::getAddressBooks();
|
||||||
|
|
||||||
$this->assertEquals(1, count($all_books));
|
$this->assertEquals(1, count($all_books));
|
||||||
$this->assertEquals('A very simple Addressbook', $all_books['SIMPLE_ADDRESS_BOOK']);
|
$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));
|
$stub2->expects($this->any())->method('search')->will($this->returnValue($searchResult2));
|
||||||
|
|
||||||
// register the address books
|
// register the address books
|
||||||
OCP\Contacts::registerAddressBook($stub1);
|
\OCP\Contacts::registerAddressBook($stub1);
|
||||||
OCP\Contacts::registerAddressBook($stub2);
|
\OCP\Contacts::registerAddressBook($stub2);
|
||||||
$all_books = OCP\Contacts::getAddressBooks();
|
$all_books = \OCP\Contacts::getAddressBooks();
|
||||||
|
|
||||||
// assert the count - doesn't hurt
|
// assert the count - doesn't hurt
|
||||||
$this->assertEquals(2, count($all_books));
|
$this->assertEquals(2, count($all_books));
|
||||||
|
|
||||||
// perform the search
|
// perform the search
|
||||||
$result = OCP\Contacts::search('x', array());
|
$result = \OCP\Contacts::search('x', array());
|
||||||
|
|
||||||
// we expect 4 hits
|
// we expect 4 hits
|
||||||
$this->assertEquals(4, count($result));
|
$this->assertEquals(4, count($result));
|
|
@ -19,7 +19,9 @@
|
||||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class Test_OCPConfig extends \Test\TestCase {
|
namespace Test\PublicNamespace;
|
||||||
|
|
||||||
|
class OCPConfigTest extends \Test\TestCase {
|
||||||
|
|
||||||
public function testSetAppValueIfSetToNull() {
|
public function testSetAppValueIfSetToNull() {
|
||||||
|
|
|
@ -19,10 +19,13 @@
|
||||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class Test_Public_Util extends \Test\TestCase {
|
namespace Test\PublicNamespace;
|
||||||
|
|
||||||
|
|
||||||
|
class UtilTest extends \Test\TestCase {
|
||||||
protected function setUp() {
|
protected function setUp() {
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
OCP\Contacts::clear();
|
\OCP\Contacts::clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
Loading…
Reference in New Issue