Skip to content

Commit

Permalink
Updated tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sayan goswami committed Sep 10, 2024
1 parent 71d0c55 commit 38359ea
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 19 deletions.
2 changes: 1 addition & 1 deletion config/services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ parameters:
env(ORCA_PACKAGES_CONFIG): config/packages.yml
ORCA_PACKAGES_CONFIG: "%env(ORCA_PACKAGES_CONFIG)%"
env(ORCA_PACKAGES_CONFIG_ALTER): ~
env(ORCA_PHPCS_STANDARD): "AcquiaDrupalTransitional"
env(ORCA_PHPCS_STANDARD): "AcquiaDrupalMinimal"
env(ORCA_PHPUNIT_DEBUG_MODE_ENABLE): "false"
env(ORCA_TELEMETRY_ENABLE): "false"
env(ORCA_IS_ALLOWED_FAILURE): "%env(ORCA_IS_ALLOWED_FAILURE)%"
Expand Down
3 changes: 0 additions & 3 deletions example/src/ExampleComplexity.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ class ExampleComplexity {

/**
* Creates some cyclomatic complexity.
*
* @return int
* An arbitrary number.
*/
public function createComplexity(): int {
$x = 0;
Expand Down
14 changes: 8 additions & 6 deletions src/Enum/PhpcsStandardEnum.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,14 @@
*/
final class PhpcsStandardEnum extends Enum {

public const ACQUIA_PHP = 'AcquiaPHP';
public const ACQUIA_PHP_MINIMAL = 'AcquiaPHPMinimal ';
public const ACQUIA_PHP_STRICT = 'AcquiaPHPStrict ';

public const ACQUIA_DRUPAL_STRICT = 'AcquiaDrupalStrict';

public const ACQUIA_DRUPAL_TRANSITIONAL = 'AcquiaDrupalTransitional';
public const ACQUIA_DRUPAL_MINIMAL = 'AcquiaDrupalMinimal';

public const DEFAULT = self::ACQUIA_DRUPAL_TRANSITIONAL;
public const DEFAULT = self::ACQUIA_DRUPAL_MINIMAL;

/**
* Provides help text for commands that accept PHPCS standard input.
Expand All @@ -30,9 +31,10 @@ final class PhpcsStandardEnum extends Enum {
*/
public static function commandHelp(): array {
return [
sprintf('- %s: Contains sniffs applicable to all PHP projects', self::ACQUIA_PHP),
sprintf('- %s: Recommended for new Drupal projects and teams familiar with Drupal coding standards', self::ACQUIA_DRUPAL_STRICT),
sprintf('- %s: A relaxed standard for legacy Drupal codebases or teams new to Drupal coding standards', self::ACQUIA_DRUPAL_TRANSITIONAL),
sprintf('- %s: Based on PSR-12 and is intended for use on all public non-Drupal projects', self::ACQUIA_PHP_MINIMAL),
sprintf('- %s: Based on AcquiaDrupal and adds the more opinionated DrupalPractice standard. It is intended for use on all internal Drupal projects', self::ACQUIA_DRUPAL_STRICT),
sprintf('- %s: Based on AcquiaPHP and adds additional, more opinionated standards. It is intended for use on all internal, non-Drupal projects', self::ACQUIA_PHP_STRICT),
sprintf('- %s: Based on the Drupal coding standard and is intended for use on all public Drupal projects', self::ACQUIA_DRUPAL_MINIMAL),
];
}

Expand Down
10 changes: 6 additions & 4 deletions tests/Console/Command/Qa/QaFixerCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,9 @@ public function testPhpcsStandardOption($args, $standard): void {
public static function providerPhpcsStandardOption(): array {
return [
[[], PhpcsStandardEnum::DEFAULT],
[['--phpcs-standard' => PhpcsStandardEnum::ACQUIA_PHP], PhpcsStandardEnum::ACQUIA_PHP],
[['--phpcs-standard' => PhpcsStandardEnum::ACQUIA_DRUPAL_TRANSITIONAL], PhpcsStandardEnum::ACQUIA_DRUPAL_TRANSITIONAL],
[['--phpcs-standard' => PhpcsStandardEnum::ACQUIA_PHP_MINIMAL], PhpcsStandardEnum::ACQUIA_PHP_MINIMAL],
[['--phpcs-standard' => PhpcsStandardEnum::ACQUIA_PHP_STRICT], PhpcsStandardEnum::ACQUIA_PHP_STRICT],
[['--phpcs-standard' => PhpcsStandardEnum::ACQUIA_DRUPAL_MINIMAL], PhpcsStandardEnum::ACQUIA_DRUPAL_MINIMAL],
[['--phpcs-standard' => PhpcsStandardEnum::ACQUIA_DRUPAL_STRICT], PhpcsStandardEnum::ACQUIA_DRUPAL_STRICT],
];
}
Expand Down Expand Up @@ -195,8 +196,9 @@ public function testPhpcsStandardEnvVar($standard): void {

public static function providerPhpcsStandardEnvVar(): array {
return [
[PhpcsStandardEnum::ACQUIA_PHP],
[PhpcsStandardEnum::ACQUIA_DRUPAL_TRANSITIONAL],
[PhpcsStandardEnum::ACQUIA_PHP_STRICT],
[PhpcsStandardEnum::ACQUIA_PHP_MINIMAL],
[PhpcsStandardEnum::ACQUIA_DRUPAL_MINIMAL],
[PhpcsStandardEnum::ACQUIA_DRUPAL_STRICT],
];
}
Expand Down
12 changes: 7 additions & 5 deletions tests/Console/Command/Qa/QaStaticAnalysisCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ public static function providerOptions(): array {
['composer', FALSE],
['coverage', FALSE],
['phpcs', FALSE],
['phpcs-standard', 'AcquiaDrupalTransitional'],
['phpcs-standard', 'AcquiaDrupalMinimal'],
['phplint', FALSE],
['phploc', FALSE],
['phpmd', FALSE],
Expand Down Expand Up @@ -307,8 +307,9 @@ public function testPhpcsStandardOption(array $args, $standard): void {
public static function providerPhpcsStandardOption(): array {
return [
[[], PhpcsStandardEnum::DEFAULT],
[['--phpcs-standard' => PhpcsStandardEnum::ACQUIA_PHP], PhpcsStandardEnum::ACQUIA_PHP],
[['--phpcs-standard' => PhpcsStandardEnum::ACQUIA_DRUPAL_TRANSITIONAL], PhpcsStandardEnum::ACQUIA_DRUPAL_TRANSITIONAL],
[['--phpcs-standard' => PhpcsStandardEnum::ACQUIA_PHP_STRICT], PhpcsStandardEnum::ACQUIA_PHP_STRICT],
[['--phpcs-standard' => PhpcsStandardEnum::ACQUIA_PHP_MINIMAL], PhpcsStandardEnum::ACQUIA_PHP_MINIMAL],
[['--phpcs-standard' => PhpcsStandardEnum::ACQUIA_DRUPAL_MINIMAL], PhpcsStandardEnum::ACQUIA_DRUPAL_MINIMAL],
[['--phpcs-standard' => PhpcsStandardEnum::ACQUIA_DRUPAL_STRICT], PhpcsStandardEnum::ACQUIA_DRUPAL_STRICT],
];
}
Expand Down Expand Up @@ -344,8 +345,9 @@ public function testPhpcsStandardEnvVar($standard): void {

public static function providerPhpcsStandardEnvVar(): array {
return [
[PhpcsStandardEnum::ACQUIA_PHP],
[PhpcsStandardEnum::ACQUIA_DRUPAL_TRANSITIONAL],
[PhpcsStandardEnum::ACQUIA_PHP_STRICT],
[PhpcsStandardEnum::ACQUIA_PHP_MINIMAL],
[PhpcsStandardEnum::ACQUIA_DRUPAL_MINIMAL],
[PhpcsStandardEnum::ACQUIA_DRUPAL_STRICT],
];
}
Expand Down

0 comments on commit 38359ea

Please sign in to comment.