|
|
|
@ -83,10 +83,10 @@ class DescriptorsTest extends TestBase |
|
|
|
|
$this->assertSame($class, $desc->getClass()); |
|
|
|
|
|
|
|
|
|
$this->assertInstanceOf('\Google\Protobuf\FieldDescriptor', $desc->getField(0)); |
|
|
|
|
$this->assertSame(7, $desc->getFieldCount()); |
|
|
|
|
$this->assertSame(8, $desc->getFieldCount()); |
|
|
|
|
|
|
|
|
|
$this->assertInstanceOf('\Google\Protobuf\OneofDescriptor', $desc->getOneofDecl(0)); |
|
|
|
|
$this->assertSame(1, $desc->getOneofDeclCount()); |
|
|
|
|
$this->assertSame(2, $desc->getOneofDeclCount()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function testDescriptorForIncludedMessage() |
|
|
|
@ -180,6 +180,7 @@ class DescriptorsTest extends TestBase |
|
|
|
|
$this->assertSame(self::GPBTYPE_MESSAGE, $fieldDesc->getType()); |
|
|
|
|
$this->assertInstanceOf('\Google\Protobuf\Descriptor', $fieldDesc->getMessageType()); |
|
|
|
|
$this->assertFalse($fieldDesc->isMap()); |
|
|
|
|
$this->assertNull($fieldDesc->getContainingOneof()); |
|
|
|
|
|
|
|
|
|
// Oneof int field |
|
|
|
|
// Tested further in testOneofDescriptor() |
|
|
|
@ -189,6 +190,21 @@ class DescriptorsTest extends TestBase |
|
|
|
|
$this->assertSame(self::GPBLABEL_OPTIONAL, $fieldDesc->getLabel()); |
|
|
|
|
$this->assertSame(self::GPBTYPE_INT32, $fieldDesc->getType()); |
|
|
|
|
$this->assertFalse($fieldDesc->isMap()); |
|
|
|
|
$this->assertSame($fieldDesc->getContainingOneof(), $fieldDesc->getRealContainingOneof()); |
|
|
|
|
|
|
|
|
|
$oneofDesc = $fieldDesc->getContainingOneof(); |
|
|
|
|
$this->assertSame('my_oneof', $oneofDesc->getName()); |
|
|
|
|
|
|
|
|
|
// Proto3 optional it field. |
|
|
|
|
// Tested further in testOneofDescriptor() |
|
|
|
|
$fieldDesc = $fieldDescMap[52]; |
|
|
|
|
$this->assertSame('proto3_optional_int32', $fieldDesc->getName()); |
|
|
|
|
$this->assertSame(52, $fieldDesc->getNumber()); |
|
|
|
|
$this->assertSame(self::GPBLABEL_OPTIONAL, $fieldDesc->getLabel()); |
|
|
|
|
$this->assertSame(self::GPBTYPE_INT32, $fieldDesc->getType()); |
|
|
|
|
$this->assertFalse($fieldDesc->isMap()); |
|
|
|
|
$this->assertNull($fieldDesc->getRealContainingOneof()); |
|
|
|
|
$this->assertNotNull($fieldDesc->getContainingOneof()); |
|
|
|
|
|
|
|
|
|
// Map int-enum field |
|
|
|
|
$fieldDesc = $fieldDescMap[71]; |
|
|
|
|