diff options
author | Paul Yang <TeBoring@users.noreply.github.com> | 2017-09-22 14:08:01 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-22 14:08:01 -0700 |
commit | ae55fd2cc52849004de21a7e26aed7bfe393eaed (patch) | |
tree | fd4abff8b105123876b58748606f40dca16582e0 /php | |
parent | c20440222afe368b2ddb1f842d469fdbe10f5389 (diff) | |
download | protobuf-ae55fd2cc52849004de21a7e26aed7bfe393eaed.tar.gz protobuf-ae55fd2cc52849004de21a7e26aed7bfe393eaed.tar.bz2 protobuf-ae55fd2cc52849004de21a7e26aed7bfe393eaed.zip |
Enforce all error report for php tests. (#3670)
* Enforce all error report for php tests.
* Import vendor/autoload.php in tests/bootstrap_phpunit.php
Diffstat (limited to 'php')
-rw-r--r-- | php/phpunit.xml | 2 | ||||
-rw-r--r-- | php/src/Google/Protobuf/Internal/DescriptorPool.php | 20 | ||||
-rwxr-xr-x | php/tests/autoload.php | 2 | ||||
-rw-r--r-- | php/tests/bootstrap_phpunit.php | 5 |
4 files changed, 24 insertions, 5 deletions
diff --git a/php/phpunit.xml b/php/phpunit.xml index d7077038..87440bbd 100644 --- a/php/phpunit.xml +++ b/php/phpunit.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<phpunit bootstrap="./vendor/autoload.php" +<phpunit bootstrap="./tests/bootstrap_phpunit.php" colors="true"> <testsuites> <testsuite name="protobuf-tests"> diff --git a/php/src/Google/Protobuf/Internal/DescriptorPool.php b/php/src/Google/Protobuf/Internal/DescriptorPool.php index 65d1a884..304c1615 100644 --- a/php/src/Google/Protobuf/Internal/DescriptorPool.php +++ b/php/src/Google/Protobuf/Internal/DescriptorPool.php @@ -109,18 +109,30 @@ class DescriptorPool public function getDescriptorByClassName($klass) { - return $this->class_to_desc[$klass]; + if (isset($this->class_to_desc[$klass])) { + return $this->class_to_desc[$klass]; + } else { + return null; + } } public function getEnumDescriptorByClassName($klass) { - return $this->class_to_enum_desc[$klass]; + if (isset($this->class_to_enum_desc[$klass])) { + return $this->class_to_enum_desc[$klass]; + } else { + return null; + } } public function getDescriptorByProtoName($proto) { - $klass = $this->proto_to_class[$proto]; - return $this->class_to_desc[$klass]; + if (isset($this->proto_to_class[$proto])) { + $klass = $this->proto_to_class[$proto]; + return $this->class_to_desc[$klass]; + } else { + return null; + } } public function getEnumDescriptorByProtoName($proto) diff --git a/php/tests/autoload.php b/php/tests/autoload.php index 0a917fc5..b98b13ab 100755 --- a/php/tests/autoload.php +++ b/php/tests/autoload.php @@ -1,5 +1,7 @@ <?php +error_reporting(E_ALL); + function getGeneratedFiles($dir, &$results = array()) { $files = scandir($dir); diff --git a/php/tests/bootstrap_phpunit.php b/php/tests/bootstrap_phpunit.php new file mode 100644 index 00000000..8452f158 --- /dev/null +++ b/php/tests/bootstrap_phpunit.php @@ -0,0 +1,5 @@ +<?php + +require_once("vendor/autoload.php"); + +error_reporting(E_ALL); |