Skip to content

Commit

Permalink
Merge pull request #8005 from haberman/php-filefix
Browse files Browse the repository at this point in the history
Moved HasOneof test into GeneratedClassTest.php, to avoid the extra file.
  • Loading branch information
haberman committed Nov 4, 2020
2 parents 957a0bf + a8a1493 commit 7b56ea3
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 28 deletions.
1 change: 0 additions & 1 deletion php/phpunit.xml
Expand Up @@ -13,7 +13,6 @@
<file>tests/DescriptorsTest.php</file>
<file>tests/GeneratedServiceTest.php</file>
<file>tests/WrapperTypeSettersTest.php</file>
<file>tests/HasOneofTest.php</file>
</testsuite>
</testsuites>
</phpunit>
17 changes: 17 additions & 0 deletions php/tests/GeneratedClassTest.php
Expand Up @@ -1671,6 +1671,23 @@ public function testDeepEquality()
# TODO: what about unknown fields?
}

#########################################################
# 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());
}

#########################################################
# Test no segfault when error happens
#########################################################
Expand Down
26 changes: 0 additions & 26 deletions php/tests/HasOneofTest.php

This file was deleted.

2 changes: 1 addition & 1 deletion php/tests/test.sh
Expand Up @@ -29,7 +29,7 @@ esac

[ -f $PHPUNIT ] || wget https://phar.phpunit.de/$PHPUNIT

tests=( ArrayTest.php EncodeDecodeTest.php GeneratedClassTest.php MapFieldTest.php WellKnownTest.php DescriptorsTest.php WrapperTypeSettersTest.php HasOneofTest.php)
tests=( ArrayTest.php EncodeDecodeTest.php GeneratedClassTest.php MapFieldTest.php WellKnownTest.php DescriptorsTest.php WrapperTypeSettersTest.php)

for t in "${tests[@]}"
do
Expand Down

0 comments on commit 7b56ea3

Please sign in to comment.