Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion BigQuery/tests/Unit/Connection/RestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ public function testApiEndpointForUniverseDomain(

$r = new \ReflectionClass($rest);
$p = $r->getProperty('apiEndpoint');
$p->setAccessible(true);

if ($envUniverse) {
// We have to do this instead of using "@runInSeparateProcess" because in the case of
Expand Down
4 changes: 1 addition & 3 deletions Bigtable/tests/Conformance/proxy/src/ProxyService.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
use Google\Cloud\Bigtable\V2\ReadRowsRequest;
use Google\Cloud\Bigtable\V2\Row;
use Google\Cloud\Bigtable\V2\SampleRowKeysResponse;
use Google\Protobuf\Internal\RepeatedField;
use Google\Protobuf\RepeatedField;
use Google\Rpc\Status;
use Grpc\ChannelCredentials;
use Monolog\Level;
Expand Down Expand Up @@ -638,7 +638,6 @@ private function protoToMutations(RepeatedField|null $protoMutations): Mutations
$mutations = new Mutations();
$reflection = new \ReflectionClass($mutations);
$property = $reflection->getProperty('mutations');
$property->setAccessible(true);
$property->setValue($mutations, $protoMutations);

return $mutations;
Expand All @@ -653,7 +652,6 @@ private function protoToRowRules(RepeatedField $protoRowRules): ReadModifyWriteR
$rowRules = new ReadModifyWriteRowRules();
$reflection = new \ReflectionClass($rowRules);
$property = $reflection->getProperty('rules');
$property->setAccessible(true);
$property->setValue($rowRules, $protoRowRules);

return $rowRules;
Expand Down
1 change: 0 additions & 1 deletion Bigtable/tests/Unit/ResumableStreamTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ public function testRetryDelayAndAttemptAreResetWhenRowReceived()
}, $delayFactor);
};
$prop = (new \ReflectionObject($resumableStream))->getProperty('delayFunction');
$prop->setAccessible(true);
$prop->setValue($resumableStream, $delayFunction);

$rows = iterator_to_array($resumableStream->readAll());
Expand Down
4 changes: 0 additions & 4 deletions Core/src/Testing/StubTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ trait StubTrait
public function ___getProperty($prop)
{
$property = $this->___getPropertyReflector($prop);

$property->setAccessible(true);
return $property->getValue($this);
}

Expand All @@ -54,8 +52,6 @@ public function ___setProperty($prop, $value)
}

$property = $this->___getPropertyReflector($prop);

$property->setAccessible(true);
$property->setValue($this, $value);
}

Expand Down
6 changes: 0 additions & 6 deletions Core/tests/Unit/Batch/SysvConfigStorageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,10 @@ public function testDefaultValues()
putenv('GOOGLE_CLOUD_BATCH_PROJECT');
$r = new \ReflectionObject($this->storage);
$p = $r->getProperty('shmSize');
$p->setAccessible(true);
$this->assertEquals(200000, $p->getValue($this->storage));
$p = $r->getProperty('perm');
$p->setAccessible(true);
$this->assertEquals(0600, $p->getValue($this->storage));
$p = $r->getProperty('project');
$p->setAccessible(true);
$this->assertEquals('A', $p->getValue($this->storage));
}

Expand All @@ -131,13 +128,10 @@ public function testEnvVarCustomization()
$storage = new SysvConfigStorage();
$r = new \ReflectionObject($storage);
$p = $r->getProperty('shmSize');
$p->setAccessible(true);
$this->assertEquals(10, $p->getValue($storage));
$p = $r->getProperty('perm');
$p->setAccessible(true);
$this->assertEquals(0666, $p->getValue($storage));
$p = $r->getProperty('project');
$p->setAccessible(true);
$this->assertEquals('B', $p->getValue($storage));
}
}
1 change: 0 additions & 1 deletion Core/tests/Unit/GrpcTraitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,6 @@ public function testUniverseDomainFromGaxConfig(
$config = $impl->getGaxConfig('1.2.3', null, $universeDomain);
$refl = new \ReflectionClass($config['credentials']);
$prop = $refl->getProperty('universeDomain');
$prop->setAccessible(true);
$universeDomain = $prop->getValue($config['credentials']);

if ($envUniverse) {
Expand Down
4 changes: 0 additions & 4 deletions Core/tests/Unit/RequestWrapperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -586,14 +586,12 @@ public function testUsesSelfSignedJwtWithScopeByDefault()
// Assert Service Account Credentials
$cacheRefClass = new \ReflectionClass($fetcherCache);
$cacheProp = $cacheRefClass->getProperty('fetcher');
$cacheProp->setAccessible(true);
$fetcher = $cacheProp->getValue($fetcherCache);
$this->assertInstanceOf(ServiceAccountCredentials::class, $fetcher);

// Assert "JWT Access With Scope" is enabled by default
$fetcherRefClass = new \ReflectionClass($fetcher);
$fetcherProp = $fetcherRefClass->getProperty('useJwtAccessWithScope');
$fetcherProp->setAccessible(true);
$this->assertTrue($fetcherProp->getValue($fetcher));

// Assert a JWT token is created without using HTTP
Expand Down Expand Up @@ -871,8 +869,6 @@ public function testRetryListenerOnConstructor()

$reflectionClass = new ReflectionClass($wrapper);
$property = $reflectionClass->getProperty('retryListener');
$property->setAccessible(true);

$this->assertNotEmpty($property->getValue($wrapper), 'The retryListener property should be set.');
$this->assertEquals(
$listener,
Expand Down
2 changes: 0 additions & 2 deletions Core/tests/Unit/ServiceBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ public function testKeyfilePathAuthPassthrough(

$ref = new \ReflectionClass($client);
$prop = $ref->getProperty('connection');
$prop->setAccessible(true);
$conn = $prop->getValue($client);
$conn->requestWrapper()
->getCredentialsFetcher()
Expand Down Expand Up @@ -129,7 +128,6 @@ public function testKeyfileAuthPassthrough(

$ref = new \ReflectionClass($client);
$prop = $ref->getProperty('connection');
$prop->setAccessible(true);
$conn = $prop->getValue($client);
$conn->requestWrapper()
->getCredentialsFetcher()
Expand Down
1 change: 0 additions & 1 deletion Core/tests/Unit/Upload/ResumableUploaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,6 @@ public function testThrowsExceptionWithFailedUpload()
public function testGetRangeStart($rangeHeader, $expectedRangeStart)
{
$method = new \ReflectionMethod(ResumableUploader::class, 'getRangeStart');
$method->setAccessible(true);

$uploader = $this->createMock(ResumableUploader::class);

Expand Down
6 changes: 0 additions & 6 deletions Datastore/tests/Snippet/DatastoreClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,10 @@ public function testMultiTenant()

$ref = new \ReflectionClass($ds);
$opProp = $ref->getProperty('operation');
$opProp->setAccessible(true);

$op = $opProp->getValue($ds);

$opRef = new \ReflectionClass($op);
$nsProp = $opRef->getProperty('namespaceId');
$nsProp->setAccessible(true);

$this->assertEquals('my-application-namespace', $nsProp->getValue($op));
}
Expand All @@ -122,13 +119,10 @@ public function testMultipleDatabases()

$ref = new \ReflectionClass($ds);
$opProp = $ref->getProperty('operation');
$opProp->setAccessible(true);

$op = $opProp->getValue($ds);

$opRef = new \ReflectionClass($op);
$dsProp = $opRef->getProperty('databaseId');
$dsProp->setAccessible(true);

$this->assertEquals('my-database', $dsProp->getValue($op));
}
Expand Down
1 change: 0 additions & 1 deletion Firestore/tests/Snippet/TransactionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,6 @@ public function setWriter(BulkWriter $writer)
{
$reflection = new ReflectionClass(Transaction::class);
$reflectionProperty = $reflection->getProperty('writer');
$reflectionProperty->setAccessible(true);
$reflectionProperty->setValue($this, $writer);
}
}
Expand Down
1 change: 0 additions & 1 deletion Logging/tests/Unit/Connection/RestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ public function testApiEndpoint()
$rb = $rest->___getProperty('requestBuilder');
$r = new \ReflectionObject($rb);
$p = $r->getProperty('baseUri');
$p->setAccessible(true);

$this->assertEquals($endpoint, $p->getValue($rb));
}
Expand Down
2 changes: 0 additions & 2 deletions Logging/tests/Unit/LoggingClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ public function testPsrBatchLogger()
$this->assertInstanceOf(PsrLogger::class, $psrBatchLogger);
$r = new \ReflectionObject($psrBatchLogger);
$p = $r->getProperty('batchEnabled');
$p->setAccessible(true);
$this->assertTrue($p->getValue($psrBatchLogger));

$psrBatchLogger = LoggingClient::psrBatchLogger(
Expand All @@ -93,7 +92,6 @@ public function testPsrBatchLogger()

$r = new \ReflectionObject($psrBatchLogger);
$method = $r->getMethod('getUnwrappedClientConfig');
$method->setAccessible(true);

$this->assertEquals(
['projectId' => 'my-project'],
Expand Down
1 change: 0 additions & 1 deletion Logging/tests/Unit/PsrLoggerBatchTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ public function testSend(
$class =
new \ReflectionClass('\\Google\\Cloud\\Logging\\PsrLogger');
$prop = $class->getProperty('loggers');
$prop->setAccessible(true);
$prop = $prop->setValue(null, [$logName => $logger]);
$psrBatchLogger->send([new Entry()]);
rewind($temp);
Expand Down
2 changes: 0 additions & 2 deletions Logging/tests/Unit/PsrLoggerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,6 @@ public function testSerializesCorrectly()
$psrLogger = unserialize(serialize($psrLogger));
$reflection = new \ReflectionClass($psrLogger);
$debugOutpoutResourceAttr = $reflection->getProperty('debugOutputResource');
$debugOutpoutResourceAttr->setAccessible(true);
$debugResourceMetadata = stream_get_meta_data(
$debugOutpoutResourceAttr->getValue($psrLogger)
);
Expand All @@ -265,7 +264,6 @@ public function testSerializesCorrectly()
];
foreach ($attributes as $attributeName) {
$attr = $reflection->getProperty($attributeName);
$attr->setAccessible(true);
$this->assertEquals(
$attr->getValue($psrLogger),
$attributeName === 'clientConfig'&& class_exists(OpisClosureSerializerV4::class)
Expand Down
9 changes: 0 additions & 9 deletions Spanner/tests/Snippet/TransactionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,6 @@ public function testInsert()
$snippet->invoke();

$reflProp = new \ReflectionProperty($this->transaction, 'mutationData');
$reflProp->setAccessible(true);
$mutations = $reflProp->getValue($this->transaction);
$this->assertArrayHasKey('insert', $mutations[0]);
}
Expand All @@ -277,7 +276,6 @@ public function testInsertBatch()
$snippet->invoke();

$reflProp = new \ReflectionProperty($this->transaction, 'mutationData');
$reflProp->setAccessible(true);
$mutations = $reflProp->getValue($this->transaction);
$this->assertArrayHasKey('insert', $mutations[0]);
}
Expand All @@ -289,7 +287,6 @@ public function testUpdate()
$snippet->invoke();

$reflProp = new \ReflectionProperty($this->transaction, 'mutationData');
$reflProp->setAccessible(true);
$mutations = $reflProp->getValue($this->transaction);
$this->assertArrayHasKey('update', $mutations[0]);
}
Expand All @@ -301,7 +298,6 @@ public function testUpdateBatch()
$snippet->invoke();

$reflProp = new \ReflectionProperty($this->transaction, 'mutationData');
$reflProp->setAccessible(true);
$mutations = $reflProp->getValue($this->transaction);
$this->assertArrayHasKey('update', $mutations[0]);
}
Expand All @@ -313,7 +309,6 @@ public function testInsertOrUpdate()
$snippet->invoke();

$reflProp = new \ReflectionProperty($this->transaction, 'mutationData');
$reflProp->setAccessible(true);
$mutations = $reflProp->getValue($this->transaction);
$this->assertArrayHasKey('insertOrUpdate', $mutations[0]);
}
Expand All @@ -325,7 +320,6 @@ public function testInsertOrUpdateBatch()
$snippet->invoke();

$reflProp = new \ReflectionProperty($this->transaction, 'mutationData');
$reflProp->setAccessible(true);
$mutations = $reflProp->getValue($this->transaction);
$this->assertArrayHasKey('insertOrUpdate', $mutations[0]);
}
Expand All @@ -337,7 +331,6 @@ public function testReplace()
$snippet->invoke();

$reflProp = new \ReflectionProperty($this->transaction, 'mutationData');
$reflProp->setAccessible(true);
$mutations = $reflProp->getValue($this->transaction);
$this->assertArrayHasKey('replace', $mutations[0]);
}
Expand All @@ -349,7 +342,6 @@ public function testReplaceBatch()
$snippet->invoke();

$reflProp = new \ReflectionProperty($this->transaction, 'mutationData');
$reflProp->setAccessible(true);
$mutations = $reflProp->getValue($this->transaction);
$this->assertArrayHasKey('replace', $mutations[0]);
}
Expand All @@ -362,7 +354,6 @@ public function testDelete()
$snippet->invoke();

$reflProp = new \ReflectionProperty($this->transaction, 'mutationData');
$reflProp->setAccessible(true);
$mutations = $reflProp->getValue($this->transaction);
$this->assertArrayHasKey('delete', $mutations[0]);
}
Expand Down
3 changes: 0 additions & 3 deletions Spanner/tests/Unit/DatabaseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2260,7 +2260,6 @@ function (Transaction $t) use ($sql) {

// Simulate calling Transaction::commmit()
$prop = new \ReflectionProperty($t, 'state');
$prop->setAccessible(true);
$prop->setValue($t, Transaction::STATE_COMMITTED);
},
[
Expand Down Expand Up @@ -2347,7 +2346,6 @@ function (Transaction $t) use ($sql) {

// Simulate calling Transaction::commmit()
$prop = new \ReflectionProperty($t, 'state');
$prop->setAccessible(true);
$prop->setValue($t, Transaction::STATE_COMMITTED);
},
['transactionOptions' => ['isolationLevel' => IsolationLevel::REPEATABLE_READ]]
Expand Down Expand Up @@ -2385,7 +2383,6 @@ function (Transaction $t) use ($sql) {

// Simulate calling Transaction::commmit()
$prop = new \ReflectionProperty($t, 'state');
$prop->setAccessible(true);
$prop->setValue($t, Transaction::STATE_COMMITTED);
},
['transactionOptions' => ['readLockMode' => ReadLockMode::OPTIMISTIC]]
Expand Down
10 changes: 0 additions & 10 deletions Spanner/tests/Unit/SpannerClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ public function testBatch()

$ref = new ReflectionClass($batch);
$prop = $ref->getProperty('session');
$prop->setAccessible(true);

$this->assertEquals(
self::SESSION,
Expand Down Expand Up @@ -560,7 +559,6 @@ public function testClientPassesIsolationLevel()

$reflectedClient = new ReflectionClass($client);
$property = $reflectedClient->getProperty('isolationLevel');
$property->setAccessible(true);
$this->assertEquals(
IsolationLevel::REPEATABLE_READ,
$property->getValue($client)
Expand All @@ -569,7 +567,6 @@ public function testClientPassesIsolationLevel()
$instance = $client->instance('test');
$reflectedInstance = new ReflectionClass($instance);
$property = $reflectedInstance->getProperty('isolationLevel');
$property->setAccessible(true);
$this->assertEquals(
IsolationLevel::REPEATABLE_READ,
$property->getValue($instance)
Expand All @@ -578,7 +575,6 @@ public function testClientPassesIsolationLevel()
$database = $instance->database('test');
$reflectedDb = new ReflectionClass($database);
$property = $reflectedDb->getProperty('isolationLevel');
$property->setAccessible(true);
$this->assertEquals(
IsolationLevel::REPEATABLE_READ,
$property->getValue($database)
Expand All @@ -597,7 +593,6 @@ public function testTransactionHasCorrectIsolationLevel()

$reflectedClient = new ReflectionClass($client);
$property = $reflectedClient->getProperty('isolationLevel');
$property->setAccessible(true);
$this->assertEquals(
IsolationLevel::REPEATABLE_READ,
$property->getValue($client)
Expand All @@ -606,7 +601,6 @@ public function testTransactionHasCorrectIsolationLevel()
$instance = $client->instance('test');
$reflectedInstance = new ReflectionClass($instance);
$property = $reflectedInstance->getProperty('isolationLevel');
$property->setAccessible(true);
$this->assertEquals(
IsolationLevel::REPEATABLE_READ,
$property->getValue($instance)
Expand All @@ -615,7 +609,6 @@ public function testTransactionHasCorrectIsolationLevel()
$database = $instance->database('test');
$reflectedDb = new ReflectionClass($database);
$property = $reflectedDb->getProperty('isolationLevel');
$property->setAccessible(true);
$this->assertEquals(
IsolationLevel::REPEATABLE_READ,
$property->getValue($database)
Expand Down Expand Up @@ -766,8 +759,6 @@ private function getTotalChannel(SpannerClient $client): int
{
$reflection = new ReflectionClass($client);
$property = $reflection->getProperty('totalActiveChannels');
$property->setAccessible('true');

return $property->getValue($client);
}

Expand All @@ -779,7 +770,6 @@ public function testConfigureKeepAlive()
]);
$reflection = new ReflectionClass($client);
$method = $reflection->getMethod('configureKeepAlive');
$method->setAccessible(true);

$config = [];
$newConfig = $method->invoke($client, $config);
Expand Down
Loading
Loading