function testFromXmlWithpostUrl() { $xml = '<filter name="test" fullData="true">' . '<postURL>http://example.com</postURL>' . '<rule type="actor">me</rule>' . '<rule type="actor">you</rule>' . '<rule type="actor">bob</rule>' . '</filter>'; $rules = array(new Services_Gnip_Rule("actor", "me"), new Services_Gnip_Rule("actor", "you"), new Services_Gnip_Rule("actor", "bob")); $f = Services_Gnip_Filter::fromXml($xml); $this->assertEquals("test", $f->name); $this->assertEquals("true", $f->fullData); $this->assertEquals("http://example.com", $f->postURL); $this->assertEquals($rules, $f->rules); }
/** * Test the ability to create a Gnip filter with XML -- with Jid -- * and compare against strings. * * @access public * @param void * @return void */ function testFromXmlWithJid() { $xml = '<filter name="test" fullData="true">' . '<jid>joe@jabber.org</jid>' . '<rule type="actor" value="me"/>' . '<rule type="actor" value="you"/>' . '<rule type="actor" value="bob"/>' . '</filter>'; $rules = array(new Services_Gnip_Rule("actor", "me"), new Services_Gnip_Rule("actor", "you"), new Services_Gnip_Rule("actor", "bob")); $f = Services_Gnip_Filter::fromXml(new SimpleXMLElement($xml)); $this->assertEquals("test", $f->name); $this->assertEquals("true", $f->fullData); $this->assertEquals("", $f->postUrl); $this->assertEquals("*****@*****.**", $f->jid); $this->assertEquals($rules, $f->rules); }