Skip to content

Commit

Permalink
PHPCS.
Browse files Browse the repository at this point in the history
  • Loading branch information
grasmash committed May 24, 2024
1 parent 584eb3d commit a914a02
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
8 changes: 7 additions & 1 deletion src/Helpers/TelemetryHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,13 @@ public function initializeAmplitude(): void {
}
}

public static function normalizeAhEnv($ah_env): string {
/**
* @param string $ah_env
* Environment name from AH_ENV.
* @return string
* Normalized environment name.
*/
public static function normalizeAhEnv(string $ah_env): string {
if (AcquiaDrupalEnvironmentDetector::isAhProdEnv($ah_env)) {
return 'prod';
}
Expand Down
11 changes: 10 additions & 1 deletion tests/phpunit/src/Misc/TelemetryHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ public function testGetEnvironmentProviderWithoutAnyEnvSet(): void {
// Expect null since no provider environment variables are set.
$this->assertNull(TelemetryHelper::getEnvironmentProvider());
}

/**
* @return mixed[]
* The data provider.
*/
public function providerTestAhEnvNormalization(): array {
return [
['prod', 'prod'],
Expand All @@ -81,8 +86,12 @@ public function providerTestAhEnvNormalization(): array {

/**
* @dataProvider providerTestAhEnvNormalization
* @param string $ah_env
* The Acquia hosting environment.
* @param string $expected
* The expected normalized environment.
*/
public function testAhEnvNormalization($ah_env, $expected) {
public function testAhEnvNormalization(string $ah_env, string $expected): void {
$normalized_ah_env = TelemetryHelper::normalizeAhEnv($ah_env);
$this->assertEquals($expected, $normalized_ah_env);
}
Expand Down

0 comments on commit a914a02

Please sign in to comment.