From 0da4145d4058ae6c8a8c2e0b54b17ab427891423 Mon Sep 17 00:00:00 2001 From: Michael Bausor Date: Wed, 16 Aug 2017 14:53:28 -0700 Subject: [PATCH 1/2] Fix DEFAULT keyword in generated protobuf class --- .../Google/Logging/Type/LogSeverity.php | 2 +- tests/InstantiateClassesTest.php | 67 +++++++++++++++++++ 2 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 tests/InstantiateClassesTest.php diff --git a/src/generated/Google/Logging/Type/LogSeverity.php b/src/generated/Google/Logging/Type/LogSeverity.php index c244d3355..bbd397108 100644 --- a/src/generated/Google/Logging/Type/LogSeverity.php +++ b/src/generated/Google/Logging/Type/LogSeverity.php @@ -27,7 +27,7 @@ class LogSeverity * * Generated from protobuf enum DEFAULT = 0; */ - const DEFAULT = 0; + const GPBDEFAULT = 0; /** * (100) Debug or trace information. * diff --git a/tests/InstantiateClassesTest.php b/tests/InstantiateClassesTest.php new file mode 100644 index 000000000..abf5a6dcd --- /dev/null +++ b/tests/InstantiateClassesTest.php @@ -0,0 +1,67 @@ + null]); + } else { + $instance = new $class(); + } + $this->assertNotNull($instance); + } + + public function classesProvider() + { + $dir = new RecursiveDirectoryIterator('src/generated/Google'); + $it = new RecursiveIteratorIterator($dir); + $reg = new RegexIterator($it, '#.+\.php$#', RecursiveRegexIterator::GET_MATCH); + foreach ($reg as $files) { + $file = $files[0]; + $namespace = str_replace("/", "\\", substr($file, 13)); + $class = explode('.', $namespace)[0]; + yield [$class]; + } + } +} From fc22d479bca9c2bcda5c9194f6626a0740fd0124 Mon Sep 17 00:00:00 2001 From: Michael Bausor Date: Wed, 16 Aug 2017 16:18:55 -0700 Subject: [PATCH 2/2] Add travis retry to pecl install because it is flaky --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index a0f9e9157..0db93a3b1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,7 +7,7 @@ php: sudo: required dist: trusty install: - - pecl install grpc + - travis_retry pecl install grpc - composer install script: - vendor/bin/phpunit --coverage-clover=coverage.xml