Skip to content

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

Open
nidhiii-27 wants to merge 3 commits into
mainfrom
compose-delete-source-php
Open

feat(storage): support delete source objects on compose#2224
nidhiii-27 wants to merge 3 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 thread storage/test/ObjectsTest.php Outdated
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());
        }

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The rest of this file uses assertTrue() and assertFalse() when checking $object->exists(). Should we update this test case for consistency?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Updated the test case to use assertTrue() and assertFalse() for consistency and readability.

@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]
@nidhiii-27 nidhiii-27 marked this pull request as ready for review June 25, 2026 14:34
@nidhiii-27 nidhiii-27 requested review from a team as code owners June 25, 2026 14:34
Comment thread storage/test/ObjectsTest.php Outdated
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.

The rest of this file uses assertTrue() and assertFalse() when checking $object->exists(). Should we update this test case for consistency?

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.

2 participants