Skip to content

Commit

Permalink
fix: deprecate assertRegexp usage (#1927)
Browse files Browse the repository at this point in the history
  • Loading branch information
vishwarajanand authored Oct 16, 2023
1 parent 7829067 commit 9c67145
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions appengine/flexible/metadata/test/DeployTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function testIndex()
'200',
$resp->getStatusCode(),
'Top page status code should be 200');
$this->assertRegExp('/External IP: .*/', (string) $resp->getBody());
$this->assertMatchesRegularExpression('/External IP: .*/', (string) $resp->getBody());
}

public function testCurl()
Expand All @@ -42,6 +42,6 @@ public function testCurl()
'200',
$resp->getStatusCode(),
'/curl status code should be 200');
$this->assertRegExp('/External IP: .*/', (string) $resp->getBody());
$this->assertMatchesRegularExpression('/External IP: .*/', (string) $resp->getBody());
}
}
8 changes: 4 additions & 4 deletions monitoring/test/alertsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function testCreatePolicy()
$output = $this->runFunctionSnippet('alert_create_policy', [
'projectId' => self::$projectId,
]);
$this->assertRegexp($regexp, $output);
$this->assertMatchesRegularExpression($regexp, $output);

// Save the policy ID for later
preg_match($regexp, $output, $matches);
Expand Down Expand Up @@ -93,7 +93,7 @@ public function testCreateChannel()
$output = $this->runFunctionSnippet('alert_create_channel', [
'projectId' => self::$projectId,
]);
$this->assertRegexp($regexp, $output);
$this->assertMatchesRegularExpression($regexp, $output);

// Save the channel ID for later
preg_match($regexp, $output, $matches);
Expand All @@ -111,14 +111,14 @@ public function testReplaceChannel()
$output = $this->runFunctionSnippet('alert_create_channel', [
'projectId' => self::$projectId,
]);
$this->assertRegexp($regexp, $output);
$this->assertMatchesRegularExpression($regexp, $output);
preg_match($regexp, $output, $matches);
$channelId1 = $matches[1];

$output = $this->runFunctionSnippet('alert_create_channel', [
'projectId' => self::$projectId,
]);
$this->assertRegexp($regexp, $output);
$this->assertMatchesRegularExpression($regexp, $output);
preg_match($regexp, $output, $matches);
$channelId2 = $matches[1];

Expand Down
6 changes: 3 additions & 3 deletions pubsub/api/test/pubsubTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -458,14 +458,14 @@ public function testPublishAndSubscribeWithOrderingKeys()
self::$projectId,
$topic,
]);
$this->assertRegExp('/Message published/', $output);
$this->assertMatchesRegularExpression('/Message published/', $output);

$output = $this->runFunctionSnippet('enable_subscription_ordering', [
self::$projectId,
$topic,
'subscriberWithOrdering' . rand(),
]);
$this->assertRegExp('/Created subscription with ordering/', $output);
$this->assertRegExp('/\"enableMessageOrdering\":true/', $output);
$this->assertMatchesRegularExpression('/Created subscription with ordering/', $output);
$this->assertMatchesRegularExpression('/\"enableMessageOrdering\":true/', $output);
}
}
2 changes: 1 addition & 1 deletion speech/test/speechTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public function testTranscribe($command, $audioFile, $requireGrpc = false)

// Check for the word time offsets
if (in_array($command, ['transcribe_async_words'])) {
$this->assertRegexp('/start: "*.*s", end: "*.*s/', $output);
$this->assertMatchesRegularExpression('/start: "*.*s", end: "*.*s/', $output);
}
}

Expand Down
2 changes: 1 addition & 1 deletion storage/test/IamTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ public function testListIamMembers()
%s
/', self::$user);
$this->assertRegexp($binding, $output);
$this->assertMatchesRegularExpression($binding, $output);

$bindingWithCondition = sprintf(
'Role: roles/storage.objectViewer
Expand Down
4 changes: 2 additions & 2 deletions vision/test/visionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public function testLandmarkCommand()
{
$path = __DIR__ . '/data/tower.jpg';
$output = $this->runFunctionSnippet('detect_landmark', ['path' => $path]);
$this->assertRegexp(
$this->assertMatchesRegularExpression(
'/Eiffel Tower|Champ de Mars|Trocadéro Gardens/',
$output
);
Expand All @@ -131,7 +131,7 @@ public function testLandmarkCommandGcs()

$path = 'gs://' . $bucketName . '/vision/tower.jpg';
$output = $this->runFunctionSnippet('detect_landmark_gcs', ['path' => $path]);
$this->assertRegexp(
$this->assertMatchesRegularExpression(
'/Eiffel Tower|Champ de Mars|Trocadéro Gardens/',
$output
);
Expand Down

0 comments on commit 9c67145

Please sign in to comment.