googleapis / googleapis/gapic-generator-php

Add Tests for DIREGAPIC Enums

Open
#433 0 comments 0 reactions 0 assignees View on GitHub
priority: p3 type: feature request
Dominant language
PHP
Stars
14
Forks
18
PR merge metrics
No merged PRs in 30d

Description

We are generating the new Enum classes for Compute, but we should also generate at least one test per service which ensures that these Enum classes look like we expect. For example, something like this:

```php
// in Compute/tests/Unit/V1/Enums/EnumTest.php

namespace Google\Cloud\Compute\Tests\Unit\V1\Enums;

use Google\Cloud\Compute\V1\Enums;

class EnumTest extends TestCase
{
public function testEnums()
{
$this->assertEquals('UNDEFINED_NETWORK_TIER', Enums\AccessConfig\NetworkTier::UNDEFINED_NETWORK_TIER);
// ...
// all the other enums
// ...
$this->assertEquals('UP', Enums\Zone\Status::UP);
}
}
```

This provides a sanity check that the Enum classes do not contain any syntax errors. As the existing tests are only for `InstanceClient` classes, and the enum classes do not map to `InstanceClient` classes (as far as I know), the easiest way to implement these tests is to create an `Enum` test class for all of them.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.