Commit ae55fd2c authored by Paul Yang's avatar Paul Yang Committed by GitHub

Enforce all error report for php tests. (#3670)

* Enforce all error report for php tests.

* Import vendor/autoload.php in tests/bootstrap_phpunit.php
parent c2044022
...@@ -674,6 +674,7 @@ php_EXTRA_DIST= \ ...@@ -674,6 +674,7 @@ php_EXTRA_DIST= \
php/src/GPBMetadata/Google/Protobuf/Internal/Descriptor.php \ php/src/GPBMetadata/Google/Protobuf/Internal/Descriptor.php \
php/tests/array_test.php \ php/tests/array_test.php \
php/tests/autoload.php \ php/tests/autoload.php \
php/tests/bootstrap_phpunit.php \
php/tests/compatibility_test.sh \ php/tests/compatibility_test.sh \
php/tests/descriptors_test.php \ php/tests/descriptors_test.php \
php/tests/encode_decode_test.php \ php/tests/encode_decode_test.php \
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="./vendor/autoload.php" <phpunit bootstrap="./tests/bootstrap_phpunit.php"
colors="true"> colors="true">
<testsuites> <testsuites>
<testsuite name="protobuf-tests"> <testsuite name="protobuf-tests">
......
...@@ -109,18 +109,30 @@ class DescriptorPool ...@@ -109,18 +109,30 @@ class DescriptorPool
public function getDescriptorByClassName($klass) 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) 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) public function getDescriptorByProtoName($proto)
{ {
$klass = $this->proto_to_class[$proto]; if (isset($this->proto_to_class[$proto])) {
return $this->class_to_desc[$klass]; $klass = $this->proto_to_class[$proto];
return $this->class_to_desc[$klass];
} else {
return null;
}
} }
public function getEnumDescriptorByProtoName($proto) public function getEnumDescriptorByProtoName($proto)
......
<?php <?php
error_reporting(E_ALL);
function getGeneratedFiles($dir, &$results = array()) function getGeneratedFiles($dir, &$results = array())
{ {
$files = scandir($dir); $files = scandir($dir);
......
<?php
require_once("vendor/autoload.php");
error_reporting(E_ALL);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment