Ejemplo n.º 1
0
 public function testNormalNicknameShouldHaveNoExtensionElements()
 {
     $this->nickname->name = "Trogdor";
     $this->assertEquals("Trogdor", $this->nickname->name);
     $this->assertEquals(0, count($this->nickname->extensionElements));
     $newNickname = new Extension\Nickname();
     $newNickname->transferFromXML($this->nickname->saveXML());
     $this->assertEquals(0, count($newNickname->extensionElements));
     $newNickname->extensionElements = array(new \Zend\GData\App\Extension\Element('foo', 'atom', null, 'bar'));
     $this->assertEquals(1, count($newNickname->extensionElements));
     $this->assertEquals("Trogdor", $newNickname->name);
     /* try constructing using magic factory */
     $gdata = new \Zend\GData\GApps();
     $newNickname2 = $gdata->newNickname();
     $newNickname2->transferFromXML($newNickname->saveXML());
     $this->assertEquals(1, count($newNickname2->extensionElements));
     $this->assertEquals("Trogdor", $newNickname2->name);
 }
Ejemplo n.º 2
0
 public function testNormalQuotaShouldHaveNoExtensionElements()
 {
     $this->quota->limit = "123456789";
     $this->assertEquals("123456789", $this->quota->limit);
     $this->assertEquals(0, count($this->quota->extensionElements));
     $newQuota = new Extension\Quota();
     $newQuota->transferFromXML($this->quota->saveXML());
     $this->assertEquals(0, count($newQuota->extensionElements));
     $newQuota->extensionElements = array(new \Zend\GData\App\Extension\Element('foo', 'atom', null, 'bar'));
     $this->assertEquals(1, count($newQuota->extensionElements));
     $this->assertEquals("123456789", $newQuota->limit);
     /* try constructing using magic factory */
     $gdata = new \Zend\GData\GApps();
     $newQuota2 = $gdata->newQuota();
     $newQuota2->transferFromXML($newQuota->saveXML());
     $this->assertEquals(1, count($newQuota2->extensionElements));
     $this->assertEquals("123456789", $newQuota2->limit);
 }
Ejemplo n.º 3
0
 public function testNormalEmailListShouldHaveNoExtensionElements()
 {
     $this->emailList->name = "test-name";
     $this->assertEquals("test-name", $this->emailList->name);
     $this->assertEquals(0, count($this->emailList->extensionElements));
     $newEmailList = new Extension\EmailList();
     $newEmailList->transferFromXML($this->emailList->saveXML());
     $this->assertEquals(0, count($newEmailList->extensionElements));
     $newEmailList->extensionElements = array(new \Zend\GData\App\Extension\Element('foo', 'atom', null, 'bar'));
     $this->assertEquals(1, count($newEmailList->extensionElements));
     $this->assertEquals("test-name", $newEmailList->name);
     /* try constructing using magic factory */
     $gdata = new \Zend\GData\GApps();
     $newEmailList2 = $gdata->newEmailList();
     $newEmailList2->transferFromXML($newEmailList->saveXML());
     $this->assertEquals(1, count($newEmailList2->extensionElements));
     $this->assertEquals("test-name", $newEmailList2->name);
 }
Ejemplo n.º 4
0
 public function testNormalLoginShouldHaveNoExtensionElements()
 {
     $this->login->username = "******";
     $this->login->password = "******";
     $this->login->hashFunctionName = "Foo";
     $this->login->suspended = true;
     $this->login->admin = true;
     $this->login->changePasswordAtNextLogin = true;
     $this->login->agreedToTerms = false;
     $this->assertEquals("johndoe", $this->login->username);
     $this->assertEquals("abcdefg1234567890", $this->login->password);
     $this->assertEquals("Foo", $this->login->hashFunctionName);
     $this->assertEquals(true, $this->login->suspended);
     $this->assertEquals(true, $this->login->admin);
     $this->assertEquals(true, $this->login->changePasswordAtNextLogin);
     $this->assertEquals(false, $this->login->agreedToTerms);
     $this->assertEquals(0, count($this->login->extensionElements));
     $newLogin = new Extension\Login();
     $newLogin->transferFromXML($this->login->saveXML());
     $this->assertEquals(0, count($newLogin->extensionElements));
     $newLogin->extensionElements = array(new \Zend\GData\App\Extension\Element('foo', 'atom', null, 'bar'));
     $this->assertEquals(1, count($newLogin->extensionElements));
     $this->assertEquals("johndoe", $newLogin->username);
     $this->assertEquals("abcdefg1234567890", $newLogin->password);
     $this->assertEquals("Foo", $newLogin->hashFunctionName);
     $this->assertEquals(true, $newLogin->suspended);
     $this->assertEquals(true, $newLogin->admin);
     $this->assertEquals(true, $newLogin->changePasswordAtNextLogin);
     $this->assertEquals(false, $newLogin->agreedToTerms);
     /* try constructing using magic factory */
     $gdata = new \Zend\GData\GApps();
     $newLogin2 = $gdata->newLogin();
     $newLogin2->transferFromXML($newLogin->saveXML());
     $this->assertEquals(1, count($newLogin2->extensionElements));
     $this->assertEquals("johndoe", $newLogin2->username);
     $this->assertEquals("abcdefg1234567890", $newLogin2->password);
     $this->assertEquals("Foo", $newLogin2->hashFunctionName);
     $this->assertEquals(true, $newLogin2->suspended);
     $this->assertEquals(true, $newLogin2->admin);
     $this->assertEquals(true, $newLogin2->changePasswordAtNextLogin);
     $this->assertEquals(false, $newLogin2->agreedToTerms);
 }