@@ -51,16 +51,18 @@ public function testAuthCloudExplicitCommand()
51
51
52
52
public function testAuthCloudExplicitComputeEngineCommand ()
53
53
{
54
- $ this ->setExpectedException ('Google\Cloud\Core\Exception\ServiceException ' );
54
+ # $this->setExpectedException('Google\Cloud\Core\Exception\ServiceException');
55
55
$ output = $ this ->runCommand (
56
56
'auth-cloud-explicit-compute-engine ' , null , $ this ->projectId );
57
+ $ this ->assertContains ('Undefined index: access_token ' , $ output );
57
58
}
58
59
59
60
public function testAuthCloudExplicitAppEngineCommand ()
60
61
{
61
- $ this ->setExpectedException ('Google\Cloud\Core\Exception\ServiceException ' );
62
+ # $this->setExpectedException('Google\Cloud\Core\Exception\ServiceException');
62
63
$ output = $ this ->runCommand (
63
64
'auth-cloud-explicit-app-engine ' , null , $ this ->projectId );
65
+ $ this ->assertContains ('Undefined index: access_token ' , $ output );
64
66
}
65
67
66
68
private function runCommand ($ commandName , $ serviceAccountPath =null , $ projectId =null )
@@ -78,12 +80,18 @@ private function runCommand($commandName, $serviceAccountPath=null, $projectId=n
78
80
['interactive ' => false ]
79
81
);
80
82
} else if ($ projectId ) {
81
- $ commandTester ->execute (
82
- [
83
- 'projectId ' => $ projectId
84
- ],
85
- ['interactive ' => false ]
86
- );
83
+ try {
84
+ $ commandTester ->execute (
85
+ [
86
+ 'projectId ' => $ projectId
87
+ ],
88
+ ['interactive ' => false ]
89
+ );
90
+ } catch (\Google \Cloud \Core \Exception \ServiceException $ e ) {
91
+ ob_get_clean ();
92
+ $ application ->renderException ($ e , $ commandTester ->getOutput ());
93
+ return $ commandTester ->getDisplay ();
94
+ }
87
95
} else {
88
96
$ commandTester ->execute ([], ['interactive ' => false ]);
89
97
}
0 commit comments