diff --git a/BigQuery/tests/Unit/Connection/RestTest.php b/BigQuery/tests/Unit/Connection/RestTest.php index f47edb96de0c..3dcefc0000d7 100644 --- a/BigQuery/tests/Unit/Connection/RestTest.php +++ b/BigQuery/tests/Unit/Connection/RestTest.php @@ -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 diff --git a/Bigtable/tests/Conformance/proxy/src/ProxyService.php b/Bigtable/tests/Conformance/proxy/src/ProxyService.php index e54c8cc92db6..d669c870cd91 100644 --- a/Bigtable/tests/Conformance/proxy/src/ProxyService.php +++ b/Bigtable/tests/Conformance/proxy/src/ProxyService.php @@ -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; @@ -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; @@ -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; diff --git a/Bigtable/tests/Unit/ResumableStreamTest.php b/Bigtable/tests/Unit/ResumableStreamTest.php index 09d95f93d619..34ceece0d8c1 100644 --- a/Bigtable/tests/Unit/ResumableStreamTest.php +++ b/Bigtable/tests/Unit/ResumableStreamTest.php @@ -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()); diff --git a/Core/src/Testing/StubTrait.php b/Core/src/Testing/StubTrait.php index 380793b40616..9434a5af1aca 100644 --- a/Core/src/Testing/StubTrait.php +++ b/Core/src/Testing/StubTrait.php @@ -35,8 +35,6 @@ trait StubTrait public function ___getProperty($prop) { $property = $this->___getPropertyReflector($prop); - - $property->setAccessible(true); return $property->getValue($this); } @@ -54,8 +52,6 @@ public function ___setProperty($prop, $value) } $property = $this->___getPropertyReflector($prop); - - $property->setAccessible(true); $property->setValue($this, $value); } diff --git a/Core/tests/Unit/Batch/SysvConfigStorageTest.php b/Core/tests/Unit/Batch/SysvConfigStorageTest.php index a219a8f58ab5..dc28538d895e 100644 --- a/Core/tests/Unit/Batch/SysvConfigStorageTest.php +++ b/Core/tests/Unit/Batch/SysvConfigStorageTest.php @@ -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)); } @@ -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)); } } diff --git a/Core/tests/Unit/GrpcTraitTest.php b/Core/tests/Unit/GrpcTraitTest.php index 8902368c9a21..0e7eca3b9130 100644 --- a/Core/tests/Unit/GrpcTraitTest.php +++ b/Core/tests/Unit/GrpcTraitTest.php @@ -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) { diff --git a/Core/tests/Unit/RequestWrapperTest.php b/Core/tests/Unit/RequestWrapperTest.php index 83aab55d39d2..66dce210cfdd 100644 --- a/Core/tests/Unit/RequestWrapperTest.php +++ b/Core/tests/Unit/RequestWrapperTest.php @@ -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 @@ -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, diff --git a/Core/tests/Unit/ServiceBuilderTest.php b/Core/tests/Unit/ServiceBuilderTest.php index 0e7060a46f33..92238146cbc1 100644 --- a/Core/tests/Unit/ServiceBuilderTest.php +++ b/Core/tests/Unit/ServiceBuilderTest.php @@ -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() @@ -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() diff --git a/Core/tests/Unit/Upload/ResumableUploaderTest.php b/Core/tests/Unit/Upload/ResumableUploaderTest.php index 1547a44986a0..0e0255e66451 100644 --- a/Core/tests/Unit/Upload/ResumableUploaderTest.php +++ b/Core/tests/Unit/Upload/ResumableUploaderTest.php @@ -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); diff --git a/Datastore/tests/Snippet/DatastoreClientTest.php b/Datastore/tests/Snippet/DatastoreClientTest.php index f0ec84d2c69b..715cb2709867 100644 --- a/Datastore/tests/Snippet/DatastoreClientTest.php +++ b/Datastore/tests/Snippet/DatastoreClientTest.php @@ -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)); } @@ -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)); } diff --git a/Firestore/tests/Snippet/TransactionTest.php b/Firestore/tests/Snippet/TransactionTest.php index 1f3bf9e51620..c4dc57239ba4 100644 --- a/Firestore/tests/Snippet/TransactionTest.php +++ b/Firestore/tests/Snippet/TransactionTest.php @@ -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); } } diff --git a/Logging/tests/Unit/Connection/RestTest.php b/Logging/tests/Unit/Connection/RestTest.php index b51754337faf..d7613e90fc17 100644 --- a/Logging/tests/Unit/Connection/RestTest.php +++ b/Logging/tests/Unit/Connection/RestTest.php @@ -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)); } diff --git a/Logging/tests/Unit/LoggingClientTest.php b/Logging/tests/Unit/LoggingClientTest.php index 3e5ffcb1173f..dc5ea016452c 100644 --- a/Logging/tests/Unit/LoggingClientTest.php +++ b/Logging/tests/Unit/LoggingClientTest.php @@ -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( @@ -93,7 +92,6 @@ public function testPsrBatchLogger() $r = new \ReflectionObject($psrBatchLogger); $method = $r->getMethod('getUnwrappedClientConfig'); - $method->setAccessible(true); $this->assertEquals( ['projectId' => 'my-project'], diff --git a/Logging/tests/Unit/PsrLoggerBatchTest.php b/Logging/tests/Unit/PsrLoggerBatchTest.php index b739bfcc4fe4..4070b11cccb9 100644 --- a/Logging/tests/Unit/PsrLoggerBatchTest.php +++ b/Logging/tests/Unit/PsrLoggerBatchTest.php @@ -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); diff --git a/Logging/tests/Unit/PsrLoggerTest.php b/Logging/tests/Unit/PsrLoggerTest.php index 1501f12a5061..a7011c7d15f2 100644 --- a/Logging/tests/Unit/PsrLoggerTest.php +++ b/Logging/tests/Unit/PsrLoggerTest.php @@ -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) ); @@ -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) diff --git a/Spanner/tests/Snippet/TransactionTest.php b/Spanner/tests/Snippet/TransactionTest.php index 3a0f9fb556ca..486dbe4bb90d 100644 --- a/Spanner/tests/Snippet/TransactionTest.php +++ b/Spanner/tests/Snippet/TransactionTest.php @@ -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]); } @@ -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]); } @@ -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]); } @@ -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]); } @@ -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]); } @@ -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]); } @@ -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]); } @@ -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]); } @@ -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]); } diff --git a/Spanner/tests/Unit/DatabaseTest.php b/Spanner/tests/Unit/DatabaseTest.php index 4cb91a878400..1b08e4d16010 100644 --- a/Spanner/tests/Unit/DatabaseTest.php +++ b/Spanner/tests/Unit/DatabaseTest.php @@ -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); }, [ @@ -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]] @@ -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]] diff --git a/Spanner/tests/Unit/SpannerClientTest.php b/Spanner/tests/Unit/SpannerClientTest.php index ce7a226ae3e4..7421d0de573a 100644 --- a/Spanner/tests/Unit/SpannerClientTest.php +++ b/Spanner/tests/Unit/SpannerClientTest.php @@ -125,7 +125,6 @@ public function testBatch() $ref = new ReflectionClass($batch); $prop = $ref->getProperty('session'); - $prop->setAccessible(true); $this->assertEquals( self::SESSION, @@ -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) @@ -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) @@ -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) @@ -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) @@ -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) @@ -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) @@ -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); } @@ -779,7 +770,6 @@ public function testConfigureKeepAlive() ]); $reflection = new ReflectionClass($client); $method = $reflection->getMethod('configureKeepAlive'); - $method->setAccessible(true); $config = []; $newConfig = $method->invoke($client, $config); diff --git a/Storage/tests/Unit/Connection/RestTest.php b/Storage/tests/Unit/Connection/RestTest.php index 1a2205307d45..7a2250edcb4a 100644 --- a/Storage/tests/Unit/Connection/RestTest.php +++ b/Storage/tests/Unit/Connection/RestTest.php @@ -80,7 +80,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 diff --git a/Trace/tests/Unit/Connection/RestTest.php b/Trace/tests/Unit/Connection/RestTest.php index 676dc259f285..7bfd8fc74866 100644 --- a/Trace/tests/Unit/Connection/RestTest.php +++ b/Trace/tests/Unit/Connection/RestTest.php @@ -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)); } diff --git a/dev/tests/Unit/DocFx/PageTest.php b/dev/tests/Unit/DocFx/PageTest.php index 92f38a7073c7..39702705040c 100644 --- a/dev/tests/Unit/DocFx/PageTest.php +++ b/dev/tests/Unit/DocFx/PageTest.php @@ -85,7 +85,6 @@ public function testLoadPagesProtoPackages() $classNodeReflection = new \ReflectionClass($classNode); $protoPackagesProperty = $classNodeReflection->getProperty('protoPackages'); - $protoPackagesProperty->setAccessible(true); $this->assertEquals( $protoPackages,