Skip to content

Commit

Permalink
chore: fix unit test failure on windows (#4050)
Browse files Browse the repository at this point in the history
  • Loading branch information
jdpedrie authored May 31, 2021
1 parent 0df2ac3 commit d88eef8
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
6 changes: 5 additions & 1 deletion .kokoro/presubmit/windows/test.bat
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ CALL php C:\Users\kbuilder\bin\composer self-update
CALL php C:\Users\kbuilder\bin\composer update

IF "%SHORT_JOB_NAME%" neq "php70" (
CALL vendor/bin/phpunit --log-junit %SHORT_JOB_NAME%\unit\sponge_log.xml
IF "%SHORT_JOB_NAME%"=="php56" (
CALL vendor/bin/phpunit -c phpunit-php5.xml.dist --log-junit %SHORT_JOB_NAME%\unit\sponge_log.xml
) ELSE (
CALL vendor/bin/phpunit --log-junit %SHORT_JOB_NAME%\unit\sponge_log.xml
)
) ELSE (
CALL vendor/bin/phpunit
)
Expand Down
2 changes: 0 additions & 2 deletions Core/src/ClientTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,8 @@

use Google\Auth\CredentialsLoader;
use Google\Auth\Credentials\GCECredentials;
use Google\Auth\HttpHandler\HttpHandlerFactory;
use Google\Cloud\Core\Compute\Metadata;
use Google\Cloud\Core\Exception\GoogleException;
use GuzzleHttp\Psr7;

/**
* Provides functionality common to each service client.
Expand Down
14 changes: 12 additions & 2 deletions Core/tests/Unit/ClientTraitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

/**
* @group core
* @group client-trait
* @group core-client-trait
*/
class ClientTraitTest extends TestCase
{
Expand Down Expand Up @@ -342,7 +342,7 @@ public function testDetectProjectIdWithKeyfileMissingProjectId()

public function testDetectProjectIdWithKeyfileMissingProjectIdSuppressNotice()
{
$trait = TestHelpers::impl(ClientTrait::class);
$trait = TestHelpers::impl(ClientTraitStubOnGceReturnsFalse::class);

$res = $trait->call('detectProjectId', [[
'keyFile' => [],
Expand All @@ -367,6 +367,16 @@ protected function getMetadata()
}
}

trait ClientTraitStubOnGceReturnsFalse
{
use ClientTrait;

protected function onGce($httpHandler)
{
return false;
}
}

trait ClientTraitStubGrpcDependencyChecks
{
use ClientTrait;
Expand Down

0 comments on commit d88eef8

Please sign in to comment.