public function testSerialization() { $msg = new XPSoapMessage(); $msg->createCall('Test', 'testSerialization'); $this->assertEquals('Test', $msg->action); $this->assertEquals('testSerialization', $msg->method); $this->assertEquals('SOAP-ENV:Envelope', $msg->root()->getName()); $this->assertNotEmpty($msg->root()->getAttributes()); $msg->setData(array('int' => 1, 'float' => 6.1, 'string' => 'Binford', 'string2' => '"<&>"', 'bool' => true, 'date' => \util\Date::fromString('1977-12-14 11:55AM Europe/Berlin'), 'null' => null, 'array' => array(2, 3), 'hash' => array('class' => 'Test', 'method' => 'testSerialization'))); // Let's be somewhat forgiving on whitespace $src = trim(chop($msg->getSource(0))); $this->assertEquals('<SOAP-ENV:Envelope', substr($src, 0, 18)); $this->assertEquals('</SOAP-ENV:Envelope>', substr($src, -20)); $this->assertContains($src, '<int xsi:type="xsd:int">1</int>', 'integer'); $this->assertContains($src, '<float xsi:type="xsd:float">6.1</float>', 'float'); $this->assertContains($src, '<string xsi:type="xsd:string">Binford</string>', 'string'); $this->assertContains($src, '<string2 xsi:type="xsd:string">"<&>"</string2>', 'escaping'); $this->assertContains($src, '<bool xsi:type="xsd:boolean">true</bool>', 'bool'); $this->assertContains($src, '<date xsi:type="xsd:dateTime">1977-12-14T11:55:00+01:00</date>', 'date'); $this->assertContains($src, '<null xsi:nil="true"/>', 'null'); $this->assertContains($src, '<array xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="xsd:anyType[2]">', 'array'); $this->assertContains($src, '<item xsi:type="xsd:int">2</item>', 'array.inner'); $this->assertContains($src, '<item xsi:type="xsd:int">3</item>', 'array.inner'); $this->assertContains($src, '<hash xsi:type="xsd:struct">', 'hash'); $this->assertContains($src, '<class xsi:type="xsd:string">Test</class>', 'hash.inner'); $this->assertContains($src, '<method xsi:type="xsd:string">testSerialization</method>', 'hash.inner'); return $src; }
/** * Set up this test * */ public function setUp() { $this->tz = date_default_timezone_get(); date_default_timezone_set('GMT'); $this->nowTime = time(); $this->nowDate = new \util\Date($this->nowTime); $this->refDate = \util\Date::fromString('1977-12-14 11:55'); }
public function orderDateParamInfo() { $this->assertEquals(OCCURRENCE_OPTIONAL, $this->wrapper->getParamInfo('orderdate', PARAM_OCCURRENCE)); $this->assertEquals(Date::fromString('1977-12-14'), $this->wrapper->getParamInfo('orderdate', PARAM_DEFAULT)); $this->assertEquals(null, $this->wrapper->getParamInfo('orderdate', PARAM_PRECHECK)); $this->assertEquals(null, $this->wrapper->getParamInfo('orderdate', PARAM_POSTCHECK)); $this->assertEquals('core:string', $this->wrapper->getParamInfo('orderdate', PARAM_TYPE)); $this->assertEquals(array(), $this->wrapper->getParamInfo('orderdate', PARAM_VALUES)); $this->assertClass($this->wrapper->getParamInfo('orderdate', PARAM_CASTER), 'scriptlet.xml.workflow.casters.ToDate'); }
public function serialization() { $original = Date::fromString('2007-07-18T09:42:08 Europe/Athens'); $copy = unserialize(serialize($original)); $this->assertEquals($original, $copy); }
/** * Setup method */ public function setUp() { $this->fixture = new MockCollection('.'); // Warning: Changing this list will make some tests fail! $this->addElement($this->fixture, new MockElement('./first.txt', 1200, Date::fromString('Oct 10 2006'), Date::fromString('Dec 14 2005'), Date::fromString('Oct 30 2005'))); $this->addElement($this->fixture, new MockElement('./second.txt', 333, Date::fromString('Oct 10 2006'), Date::fromString('Dec 24 2005'), Date::fromString('Oct 30 2005'))); $this->addElement($this->fixture, new MockElement('./third.jpg', 18882, Date::fromString('Dec 11 2003'), Date::fromString('Dec 10 2003'), Date::fromString('Dec 10 2003'))); $this->addElement($this->fixture, new MockElement('./zerobytes.png', 0, Date::fromString('Dec 11 2003'), Date::fromString('Dec 10 2003'), Date::fromString('Dec 10 2003'))); with($sub = $this->addElement($this->fixture, new MockCollection('./sub'))); $this->addElement($sub, new MockElement('./sub/IMG_6100.jpg', 531718, Date::fromString('Mar 9 2006'), Date::fromString('Mar 9 2006'), Date::fromString('Mar 9 2006'))); $this->addElement($sub, new MockElement('./sub/IMG_6100.txt', 5932, Date::fromString('Mar 13 2006'), Date::fromString('Mar 13 2006'), Date::fromString('Mar 13 2006'))); with($sec = $this->addElement($this->fixture, new MockCollection('./sub/sec'))); $this->addElement($sec, new MockElement('./sub/sec/lang.base.php', 16739, Date::fromString('Oct 11 2006'), Date::fromString('Oct 11 2006'), Date::fromString('Feb 21 2002'))); $this->addElement($sec, new MockElement('./sub/sec/__xp__.php', 8589, Date::fromString('Oct 8 2006'), Date::fromString('Oct 8 2006'), Date::fromString('Jul 23 2006'))); // Self-check $this->assertEquals($this->total, array_sum($this->sizes)); }