From a8a1493f35f5c3d8e25ccde4a9e206c31a855563 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Wed, 4 Nov 2020 11:32:43 -0800 Subject: [PATCH] Moved HasOneof test into GeneratedClassTest.php, to avoid the extra file. --- php/phpunit.xml | 1 - php/tests/GeneratedClassTest.php | 17 +++++++++++++++++ php/tests/HasOneofTest.php | 26 -------------------------- php/tests/test.sh | 2 +- 4 files changed, 18 insertions(+), 28 deletions(-) delete mode 100644 php/tests/HasOneofTest.php diff --git a/php/phpunit.xml b/php/phpunit.xml index f00d4a3d1267..8e7583596bfb 100644 --- a/php/phpunit.xml +++ b/php/phpunit.xml @@ -13,7 +13,6 @@ tests/DescriptorsTest.php tests/GeneratedServiceTest.php tests/WrapperTypeSettersTest.php - tests/HasOneofTest.php diff --git a/php/tests/GeneratedClassTest.php b/php/tests/GeneratedClassTest.php index 90c1069ed3c6..037bd1be9c5c 100644 --- a/php/tests/GeneratedClassTest.php +++ b/php/tests/GeneratedClassTest.php @@ -1671,6 +1671,23 @@ public function testDeepEquality() # TODO: what about unknown fields? } + ######################################################### + # Test hasOneof 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 ######################################################### diff --git a/php/tests/HasOneofTest.php b/php/tests/HasOneofTest.php deleted file mode 100644 index e7f8954bfd27..000000000000 --- a/php/tests/HasOneofTest.php +++ /dev/null @@ -1,26 +0,0 @@ - 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()); - } - -} diff --git a/php/tests/test.sh b/php/tests/test.sh index f693fe612750..91ea56ec8f5b 100755 --- a/php/tests/test.sh +++ b/php/tests/test.sh @@ -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