public function testFactory() { $timestamp = time(); $data = array('id' => 'testid', 'owner' => 'testowner', 'subject' => 'testsubject', 'creation' => $timestamp); $ret = Group::factory($data); $this->assertEquals($data['id'], $ret->getId()); $this->assertEquals($data['owner'], $ret->getOwner()); $this->assertEquals($data['subject'], $ret->getSubject()); $datetime = new DateTime(); $datetime->setTimestamp($data['creation']); $this->assertEquals($datetime, $ret->getCreation()); }
/** * @param NodeInterface $node * @return Group[] */ protected function getGroupsFromNode(NodeInterface $node) { $groupList = array(); if ($node->getChild(0) != null) { foreach ($node->getChildren() as $child) { $groupList[] = Group::factory($child->getAttributes()); } } return $groupList; }