public function testNormalAuthorShouldHaveNoExtensionElements() { $this->author->name = new Extension\Name('Jeff Scudder'); $this->assertEquals($this->author->name->text, 'Jeff Scudder'); $this->assertEquals(count($this->author->extensionElements), 0); $newAuthor = new Extension\Author(); $newAuthor->transferFromXML($this->author->saveXML()); $this->assertEquals(count($newAuthor->extensionElements), 0); $newAuthor->extensionElements = array(new Extension\Element('foo', 'atom', null, 'bar')); $this->assertEquals(count($newAuthor->extensionElements), 1); $this->assertEquals($newAuthor->name->text, 'Jeff Scudder'); /* try constructing using magic factory */ $app = new \Zend\GData\App\App(); $newAuthor2 = $app->newAuthor(); $newAuthor2->transferFromXML($newAuthor->saveXML()); $this->assertEquals(count($newAuthor2->extensionElements), 1); $this->assertEquals($newAuthor2->name->text, 'Jeff Scudder'); }
public function testNormalCategoryShouldHaveNoExtensionElements() { $this->category->scheme = 'http://schemas.google.com/g/2005#kind'; $this->assertEquals($this->category->scheme, 'http://schemas.google.com/g/2005#kind'); $this->assertEquals(count($this->category->extensionElements), 0); $newCategory = new Extension\Category(); $newCategory->transferFromXML($this->category->saveXML()); $this->assertEquals(0, count($newCategory->extensionElements)); $newCategory->extensionElements = array(new Extension\Element('foo', 'atom', null, 'bar')); $this->assertEquals(count($newCategory->extensionElements), 1); $this->assertEquals($newCategory->scheme, 'http://schemas.google.com/g/2005#kind'); /* try constructing using magic factory */ $app = new \Zend\GData\App\App(); $newCategory2 = $app->newCategory(); $newCategory2->transferFromXML($newCategory->saveXML()); $this->assertEquals(count($newCategory2->extensionElements), 1); $this->assertEquals($newCategory2->scheme, 'http://schemas.google.com/g/2005#kind'); }