Skip to content

Commit e76ca18

Browse files
authored
set grpc to v1.4.1 and other test fixes (GoogleCloudPlatform#422)
1 parent 44cd776 commit e76ca18

File tree

7 files changed

+14
-7
lines changed

7 files changed

+14
-7
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ before_install:
4141
- mkdir -p build/logs
4242

4343
before_script:
44-
- travis_retry pecl install grpc
44+
- travis_retry pecl install grpc-1.4.1
4545

4646
script:
4747
- testing/run_all_tests.sh

logging/api/test/ListEntriesCommandTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,6 @@ public function testListEntries()
8484
);
8585
$output = ob_get_clean();
8686
$this->assertRegexp('/: Test Message/', $output);
87-
});
87+
}, 10);
8888
}
8989
}

monitoring/test/monitoringTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ private function runCommand($commandName, $args = [])
135135
$commandTester->execute(
136136
['project_id' => self::$projectId] + $args,
137137
['interactive' => false]);
138-
} catch (\Google\GAX\Exception $e) {
138+
} catch (\Google\GAX\ApiException $e) {
139139
// if the command throws an error cast it as a string (as this would be the output)
140140
$application->renderException($e, $commandTester->getOutput());
141141
return $commandTester->getDisplay();

vision/phpunit.xml.dist

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,7 @@
2828
<directory suffix=".php">./srcdirectory>
2929
whitelist>
3030
filter>
31+
<php>
32+
<env name="PHPUNIT_TESTS" value="1"/>
33+
php>
3134
phpunit>

vision/src/detect_web.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,9 @@ function detect_web($projectId, $path)
6262
printf('%d Web Entities found:' . PHP_EOL, count($web->entities()));
6363
foreach ($web->entities() as $entity) {
6464
printf('Score: %f' . PHP_EOL, $entity->score());
65-
printf('Description: %s' . PHP_EOL, $entity->description());
65+
if (isset($entity->info()['description'])) {
66+
printf('Description: %s' . PHP_EOL, $entity->description());
67+
}
6668
printf(PHP_EOL);
6769
}
6870
}

vision/src/detect_web_gcs.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,9 @@ function detect_web_gcs($projectId, $bucketName, $objectName)
6868
printf('%d Web Entities found:' . PHP_EOL, count($web->entities()));
6969
foreach ($web->entities() as $entity) {
7070
printf('Score: %f' . PHP_EOL, $entity->score());
71-
printf('Description: %s' . PHP_EOL, $entity->description());
71+
if (isset($entity->info()['description'])) {
72+
printf('Description: %s' . PHP_EOL, $entity->description());
73+
}
7274
printf(PHP_EOL);
7375
}
7476
}

vision/test/CommandTest.php renamed to vision/test/visionTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@
2121
use Symfony\Component\Console\Tester\CommandTester;
2222

2323
/**
24-
* Unit Tests for transcribe commands.
24+
* Unit Tests for vision commands.
2525
*/
26-
class CommandTest extends \PHPUnit_Framework_TestCase
26+
class visionTest extends \PHPUnit_Framework_TestCase
2727
{
2828
private $bucketName;
2929

0 commit comments

Comments
 (0)