Skip to content

feat(storage): support delete source objects on compose#2224

Draft
nidhiii-27 wants to merge 2 commits into
mainfrom
compose-delete-source-php
Draft

feat(storage): support delete source objects on compose#2224
nidhiii-27 wants to merge 2 commits into
mainfrom
compose-delete-source-php

Conversation

@nidhiii-27

Copy link
Copy Markdown

Updates compose file sample to support deleting source objects optionally. Fixes b/441557254

[Generated-by: AI]

Updates compose file sample to support deleting source objects optionally. Fixes b/441557254

[Generated-by: AI]

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds an optional $deleteSourceObjects parameter to the compose_file function, enabling the deletion of source objects after composition. The test suite has been updated with a data provider to cover both cases. The review feedback suggests replacing the assertEquals calls on boolean values with more idiomatic assertTrue and assertFalse assertions in the tests.

Comment on lines +303 to +304
$this->assertEquals(!$deleteSourceObjects, $bucket->object($object1Name)->exists());
$this->assertEquals(!$deleteSourceObjects, $bucket->object($object2Name)->exists());

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Using assertEquals with a boolean value is a PHPUnit anti-pattern. It is more idiomatic and readable to use assertTrue or assertFalse directly, which also aligns with the assertion style used elsewhere in this test file.

        if ($deleteSourceObjects) {
            $this->assertFalse($bucket->object($object1Name)->exists());
            $this->assertFalse($bucket->object($object2Name)->exists());
        } else {
            $this->assertTrue($bucket->object($object1Name)->exists());
            $this->assertTrue($bucket->object($object2Name)->exists());
        }

@product-auto-label product-auto-label Bot added api: storage Issues related to the Cloud Storage API. samples Issues that are directly related to samples. labels Jun 24, 2026
Removed trailing whitespaces in storage/test/ObjectsTest.php which caused the styles GitHub Actions check to fail.

[Generated-by: AI]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: storage Issues related to the Cloud Storage API. samples Issues that are directly related to samples.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant