Merge pull request #8003 from anight/php_extension_add_has_oneof_field_method
add missing hasOneof method to check presence of oneof fieldspull/8005/head
commit
957a0bf08c
4 changed files with 62 additions and 1 deletions
@ -0,0 +1,26 @@ |
||||
<?php |
||||
|
||||
require_once('test_util.php'); |
||||
|
||||
use Foo\TestMessage; |
||||
|
||||
class HasOneofTest extends \PHPUnit\Framework\TestCase { |
||||
|
||||
######################################################### |
||||
# Test hasOneof<Field> methods exists and working |
||||
######################################################### |
||||
|
||||
public function testHasOneof() { |
||||
$m = new TestMessage(); |
||||
$this->assertFalse($m->hasOneofInt32()); |
||||
$m->setOneofInt32(42); |
||||
$this->assertTrue($m->hasOneofInt32()); |
||||
$m->setOneofString("bar"); |
||||
$this->assertFalse($m->hasOneofInt32()); |
||||
$this->assertTrue($m->hasOneofString()); |
||||
$m->clear(); |
||||
$this->assertFalse($m->hasOneofInt32()); |
||||
$this->assertFalse($m->hasOneofString()); |
||||
} |
||||
|
||||
} |
Loading…
Reference in new issue