public function testSimpleMessageClear() { $simple = new Simple(); $simple->setBool(true); $simple->setString("foo"); $simple->setFloat(12345.123); $simple->setUint32(123456789); $simple->setInt32(-123456789); $simple->setFixed32(123456789); $simple->setSint32(-123456789); $simple->setSfixed32(-123456789); $simple->setDouble(123456789.12345); $simple->setInt64(-123456789123456789); $simple->setUint64(123456789123456789); $simple->setFixed64(123456789123456789); $simple->setSint64(-123456789123456789); $simple->setBytes(Stream::wrap("bar")); $simple->setSfixed64(-123456789123456789); $this->assertSame(true, $simple->getBool()); $this->assertSame("foo", $simple->getString()); $this->assertSame(12345.123, $simple->getFloat()); $this->assertSame(123456789, $simple->getUint32()); $this->assertSame(-123456789, $simple->getInt32()); $this->assertSame(123456789, $simple->getFixed32()); $this->assertSame(-123456789, $simple->getSint32()); $this->assertSame(-123456789, $simple->getSfixed32()); $this->assertSame(123456789.12345, $simple->getDouble()); $this->assertSame(-123456789123456789, $simple->getInt64()); $this->assertSame(123456789123456789, $simple->getUint64()); $this->assertSame(123456789123456789, $simple->getFixed64()); $this->assertSame(-123456789123456789, $simple->getSint64()); $this->assertSame(-123456789123456789, $simple->getSfixed64()); $this->assertInstanceOf('Protobuf\\Stream', $simple->getBytes()); $simple->clear(); $this->assertNull($simple->getBool()); $this->assertNull($simple->getString()); $this->assertNull($simple->getFloat()); $this->assertNull($simple->getUint32()); $this->assertNull($simple->getInt32()); $this->assertNull($simple->getFixed32()); $this->assertNull($simple->getSint32()); $this->assertNull($simple->getSfixed32()); $this->assertNull($simple->getDouble()); $this->assertNull($simple->getInt64()); $this->assertNull($simple->getUint64()); $this->assertNull($simple->getFixed64()); $this->assertNull($simple->getSint64()); $this->assertNull($simple->getSfixed64()); $this->assertNull($simple->getBytes()); }
public function testSimpleMessageMergeNullComparison() { $simple1 = new Simple(); $simple2 = new Simple(); $bytes = Stream::wrap("bar"); $simple1->setBool(false); $simple1->setFloat(0.0); $simple1->setUint32(0); $simple2->merge($simple1); $this->assertSame(false, $simple2->getBool()); $this->assertSame(0.0, $simple2->getFloat()); $this->assertSame(0, $simple2->getUint32()); }