Exemplo n.º 1
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\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);
 }