Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bshaffer committed May 3, 2024
1 parent c981a4d commit 2feb67d
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 18 deletions.
2 changes: 1 addition & 1 deletion dev/src/Command/AddComponentCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
];
$repoMetadataFullPath = $this->rootPath . '/.repo-metadata-full.json';
$repoMetadataFull = json_decode(file_get_contents($repoMetadataFullPath), true);
$repoMetadataFull[$new->composerPackage] = $repoMetadata;
$repoMetadataFull[$new->componentName] = $repoMetadata;
file_put_contents(
$repoMetadataFullPath,
json_encode($repoMetadataFull, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)
Expand Down
6 changes: 3 additions & 3 deletions dev/src/Component.php
Original file line number Diff line number Diff line change
Expand Up @@ -187,13 +187,13 @@ private function validateComponentFiles(): void
if (!$repoMetadataFullJson) {
throw new RuntimeException('Invalid .repo-metadata-full.json');
}
if (!isset($repoMetadataFullJson[$this->packageName])) {
if (!isset($repoMetadataFullJson[$this->name])) {
throw new RuntimeException(sprintf(
'repo metadata not found in .repo-metadata-full.json for component "%s"',
'repo metadata for component "%s" not found in .repo-metadata-full.json',
$this->name
));
}
$repoMetadataJson = $repoMetadataFullJson[$this->packageName];
$repoMetadataJson = $repoMetadataFullJson[$this->name];
if (empty($repoMetadataJson['release_level'])) {
throw new RuntimeException(sprintf(
'repo metadata does not contain "release_level" for component "%s"',
Expand Down
2 changes: 1 addition & 1 deletion dev/tests/Unit/Command/AddComponentCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public function testAddComponent()
}

$repoMetadataFull = json_decode(file_get_contents(self::$tmpDir . '/.repo-metadata-full.json'), true);
$this->assertArrayHasKey('google/cloud-secretmanager', $repoMetadataFull);
$this->assertArrayHasKey('SecretManager', $repoMetadataFull);
$this->assertComposerJson('SecretManager');
}

Expand Down
13 changes: 0 additions & 13 deletions dev/tests/Unit/Command/ComponentInfoCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,6 @@
*/
class ComponentInfoCommandTest extends TestCase
{
private static $expectedFiles = [
'.OwlBot.yaml',
'.gitattributes',
'.github/pull_request_template.md',
'.repo-metadata.json',
'CONTRIBUTING.md',
'LICENSE',
'README.md',
'VERSION',
'owlbot.py',
'phpunit.xml.dist',
];

private static CommandTester $commandTester;

public static function setUpBeforeClass(): void
Expand Down

0 comments on commit 2feb67d

Please sign in to comment.