Skip to content

Commit 38deccc

Browse files
authored
chore(Spanner): V2 cleanup (#8665)
1 parent bfc0dd6 commit 38deccc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+1146
-900
lines changed

Core/src/Testing/Snippet/SnippetTestCase.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232
*/
3333
class SnippetTestCase extends TestCase
3434
{
35+
const PROJECT = 'my-awesome-project';
36+
3537
use CheckForClassTrait;
3638

3739
private static $coverage;

Core/tests/Unit/Batch/OpisClosureSerializerTest.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,13 @@
2525
/**
2626
* @group core
2727
* @group batch
28+
* @runTestsInSeparateProcesses
2829
*/
2930
class OpisClosureSerializerTest extends TestCase
3031
{
3132
public function testWrapAndUnwrapClosures()
3233
{
33-
if (!method_exists(SerializableClosure::class, 'enterContext')) {
34+
if (!@method_exists(SerializableClosure::class, 'enterContext')) {
3435
$this->markTestSkipped('Requires ops/serializer:v3');
3536
}
3637

@@ -49,8 +50,8 @@ public function testWrapAndUnwrapClosures()
4950

5051
public function testWrapAndUnwrapClosuresV4()
5152
{
52-
if (!function_exists('Opis\Closure\serialize')) {
53-
$this->markTestSkipped('Requires ops/serializer:v3');
53+
if (@method_exists(SerializableClosure::class, 'enterContext')) {
54+
$this->markTestSkipped('Requires ops/serializer:v4');
5455
}
5556

5657
$data['closure'] = function () {

Core/tests/Unit/Lock/FlockLockTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
/**
2626
* @group core
2727
* @group lock
28+
* @runTestsInSeparateProcesses
2829
*/
2930
class FlockLockTest extends TestCase
3031
{

Core/tests/Unit/Lock/SemaphoreLockTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
/**
2727
* @group core
2828
* @group lock
29+
* @runTestsInSeparateProcesses
2930
*/
3031
class SemaphoreLockTest extends TestCase
3132
{

Datastore/tests/Snippet/FilterTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class FilterTest extends SnippetTestCase
2424
use ProphecyTrait;
2525
use ProtoEncodeTrait;
2626

27-
private const PROJECT = 'alpha-project';
27+
const PROJECT = 'alpha-project';
2828
private $gapicClient;
2929
private $datastore;
3030
private $operation;

PubSub/tests/Snippet/PubSubClientTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class PubSubClientTest extends SnippetTestCase
4343
{
4444
use ProphecyTrait;
4545

46-
private const PROJECT_ID = 'my-awesome-project';
46+
const PROJECT_ID = 'my-awesome-project';
4747
private const TOPIC = 'projects/my-awesome-project/topics/my-new-topic';
4848
private const SUBSCRIPTION = 'projects/my-awesome-project/subscriptions/my-new-subscription';
4949
private const SNAPSHOT = 'projects/my-awesome-project/snapshots/my-snapshot';

PubSub/tests/Snippet/SnapshotTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class SnapshotTest extends SnippetTestCase
3838
use ProphecyTrait;
3939
use ApiHelperTrait;
4040

41-
private const PROJECT = 'my-awesome-project';
41+
const PROJECT = 'my-awesome-project';
4242
private const SNAPSHOT = 'projects/my-awesome-project/snapshots/my-snapshot';
4343
private const PROJECT_ID = 'my-awesome-project';
4444

Spanner/composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
"google/gax": "^1.38.0"
1111
},
1212
"require-dev": {
13-
"phpunit/phpunit": "^9.0",
14-
"phpspec/prophecy-phpunit": "^2.0",
15-
"squizlabs/php_codesniffer": "2.*",
13+
"phpunit/phpunit": "^9.6",
14+
"phpspec/prophecy-phpunit": "^2.1",
15+
"squizlabs/php_codesniffer": "3.*",
1616
"phpdocumentor/reflection": "^5.3.3||^6.0",
1717
"phpdocumentor/reflection-docblock": "^5.3",
1818
"erusev/parsedown": "^1.6",

Spanner/src/Backup.php

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
use DateTimeInterface;
2222
use Google\ApiCore\Options\CallOptions;
2323
use Google\ApiCore\ValidationException;
24+
use Google\Cloud\Core\ApiHelperTrait;
2425
use Google\Cloud\Core\Exception\NotFoundException;
2526
use Google\Cloud\Core\Iterator\ItemIterator;
2627
use Google\Cloud\Core\LongRunning\LongRunningClientConnection;
@@ -51,6 +52,7 @@
5152
class Backup
5253
{
5354
use RequestTrait;
55+
use ApiHelperTrait;
5456

5557
const STATE_READY = State::READY;
5658
const STATE_CREATING = State::CREATING;
@@ -372,22 +374,17 @@ public function state(array $options = []): int|null
372374
*/
373375
public function updateExpireTime(DateTimeInterface $newTimestamp, array $options = []): array
374376
{
375-
$options += [
376-
'backup' => [
377-
'name' => $this->name(),
378-
'expireTime' => $this->formatTimeAsArray($newTimestamp),
379-
],
380-
'updateMask' => [
381-
'paths' => ['expire_time']
382-
]
383-
];
377+
$options['expireTime'] = $this->formatTimeAsArray($newTimestamp);
384378

385379
/**
386380
* @var UpdateBackupRequest $updateBackup
387381
* @var array $callOptions
388382
*/
389383
[$updateBackup, $callOptions] = $this->validateOptions(
390-
$options,
384+
[
385+
'backup' => $options + ['name' => $this->name()],
386+
'updateMask' => $this->fieldMask($options),
387+
],
391388
new UpdateBackupRequest(),
392389
CallOptions::class,
393390
);

0 commit comments

Comments
 (0)