OXIESEC PANEL
- Current Dir:
/
/
var
/
www
/
firebase
/
vendor
/
google
/
cloud-core
/
tests
/
Unit
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
08/12/2024 10:33:49 AM
rwxr-xr-x
📄
AnonymousCredentialsTest.php
1.71 KB
08/12/2024 10:33:49 AM
rw-r--r--
📄
ApiHelperTraitTest.php
7.08 KB
08/12/2024 10:33:49 AM
rw-r--r--
📄
ArrayTraitTest.php
4.58 KB
08/12/2024 10:33:49 AM
rw-r--r--
📁
Batch
-
08/12/2024 10:36:17 AM
rwxr-xr-x
📄
BlobTest.php
1.28 KB
08/12/2024 10:33:49 AM
rw-r--r--
📄
CallTraitTest.php
1.56 KB
08/12/2024 10:33:49 AM
rw-r--r--
📄
ClientTraitTest.php
11.18 KB
08/12/2024 10:33:49 AM
rw-r--r--
📁
Compute
-
08/12/2024 10:36:37 AM
rwxr-xr-x
📄
ConcurrencyControlTraitTest.php
1.54 KB
08/12/2024 10:33:49 AM
rw-r--r--
📄
DetectProjectIdTraitTest.php
4.82 KB
08/12/2024 10:33:49 AM
rw-r--r--
📄
DurationTest.php
1.53 KB
08/12/2024 10:33:49 AM
rw-r--r--
📄
EmulatorTraitTest.php
2.3 KB
08/12/2024 10:33:49 AM
rw-r--r--
📁
Exception
-
08/12/2024 10:34:56 AM
rwxr-xr-x
📄
ExponentialBackoffTest.php
5.93 KB
08/12/2024 10:33:49 AM
rw-r--r--
📄
Fixtures.php
1.1 KB
08/12/2024 10:33:49 AM
rw-r--r--
📄
GeoPointTest.php
2.9 KB
08/12/2024 10:33:49 AM
rw-r--r--
📄
GrpcRequestWrapperTest.php
10.54 KB
08/12/2024 10:33:50 AM
rw-r--r--
📄
GrpcTraitTest.php
8.16 KB
08/12/2024 10:33:50 AM
rw-r--r--
📁
Iam
-
08/12/2024 10:34:57 AM
rwxr-xr-x
📄
Int64Test.php
1.24 KB
08/12/2024 10:33:50 AM
rw-r--r--
📁
Iterator
-
08/12/2024 10:34:57 AM
rwxr-xr-x
📄
JsonTraitTest.php
1.68 KB
08/12/2024 10:33:50 AM
rw-r--r--
📁
Lock
-
08/12/2024 10:34:57 AM
rwxr-xr-x
📁
Logger
-
08/12/2024 10:34:57 AM
rwxr-xr-x
📁
LongRunning
-
08/12/2024 10:34:58 AM
rwxr-xr-x
📁
Report
-
08/12/2024 10:34:58 AM
rwxr-xr-x
📄
RequestBuilderTest.php
4.74 KB
08/12/2024 10:33:50 AM
rw-r--r--
📄
RequestHandlerTest.php
10.55 KB
08/12/2024 10:33:50 AM
rw-r--r--
📄
RequestWrapperTest.php
32.14 KB
08/12/2024 10:33:50 AM
rw-r--r--
📄
RestTraitTest.php
8.72 KB
08/12/2024 10:33:50 AM
rw-r--r--
📄
RetryDeciderTraitTest.php
3.11 KB
08/12/2024 10:33:50 AM
rw-r--r--
📄
ServiceBuilderTest.php
6.54 KB
08/12/2024 10:33:50 AM
rw-r--r--
📄
ServicesNotFoundTest.php
3.25 KB
08/12/2024 10:33:50 AM
rw-r--r--
📁
Stubs
-
08/12/2024 10:34:58 AM
rwxr-xr-x
📄
SysvTraitTest.php
1.59 KB
08/12/2024 10:33:50 AM
rw-r--r--
📄
TimestampTest.php
7.54 KB
08/12/2024 10:33:50 AM
rw-r--r--
📄
TimestampTraitTest.php
2.27 KB
08/12/2024 10:33:50 AM
rw-r--r--
📁
Upload
-
08/12/2024 10:34:59 AM
rwxr-xr-x
📄
UriTraitTest.php
1.82 KB
08/12/2024 10:33:50 AM
rw-r--r--
📄
ValidateTraitTest.php
2 KB
08/12/2024 10:33:50 AM
rw-r--r--
📄
WhitelistTraitTest.php
1.47 KB
08/12/2024 10:33:50 AM
rw-r--r--
📁
fixtures
-
08/12/2024 10:34:56 AM
rwxr-xr-x
Editing: ApiHelperTraitTest.php
Close
<?php /** * Copyright 2023 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ namespace Google\Cloud\Core\Tests\Unit; use Google\Cloud\Core\Duration; use Google\Cloud\Core\Testing\GrpcTestTrait; use Google\Cloud\Core\Tests\Unit\Stubs\ApiHelpersTraitImpl; use PHPUnit\Framework\TestCase; use Prophecy\PhpUnit\ProphecyTrait; /** * @group core */ class ApiHelperTraitTest extends TestCase { use GrpcTestTrait; use ProphecyTrait; private $implementation; public function setUp(): void { $this->implementation = new ApiHelpersTraitImpl(); } public function testFormatsTimestamp() { $timestamp = [ 'seconds' => '1471242909', 'nanos' => '1' ]; $this->assertEquals( '2016-08-15T06:35:09.000000001Z', $this->implementation->formatTimestampFromApi($timestamp) ); } public function testFormatsStruct() { $value = 'test'; $struct = [ $value => [ $value => $value ] ]; $expected = [ 'fields' => [ $value => [ 'struct_value' => [ 'fields' => [ $value => [ 'string_value' => $value ] ] ] ] ] ]; $this->assertEquals($expected, $this->implementation->formatStructForApi($struct)); } public function testFormatsList() { $value = 'test'; $list = [ $value, $value ]; $expected = [ 'values' => [ [ 'string_value' => $value, ], [ 'string_value' => $value ] ] ]; $this->assertEquals($expected, $this->implementation->formatListForApi($list)); } /** * @dataProvider timestampProvider */ public function testFormatTimestampForApi($timestamp, $expectedSeconds, $expectedNanos) { $result = $this->implementation->formatTimestampForApi($timestamp); $this->assertEquals($expectedSeconds, $result['seconds']); $this->assertEquals($expectedNanos, $result['nanos']); } public function timestampProvider() { return [ [ '2017-08-24T00:38:30.611529Z', '1503535110', '611529000' ], [ '2017-08-24T00:38:30.000000000Z', '1503535110', '0' ], [ '2017-08-24T00:38:30.000000001Z', '1503535110', '1' ], [ '2017-04-06T20:52:45.989898989Z', '1491511965', '989898989' ] ]; } /** * @dataProvider durationProvider */ public function testFormatsDuration($value, $expected) { $this->assertEquals($expected, $this->implementation->formatDurationForApi($value)); } public function durationProvider() { return [ [ '1.0s', ['seconds' => 1, 'nanos' => 0] ], [ '5.11111111s', ['seconds' => 5, 'nanos' => 111111110] ], [ new Duration(1, 0), ['seconds' => 1, 'nanos' => 0] ], [ new Duration(1, 1), ['seconds' => 1, 'nanos' => 1] ], [ new Duration(1, 1e+9), ['seconds' => 1, 'nanos' => 1e+9] ] ]; } /** * @dataProvider formatValueProvider */ public function testFormatsValue($value, $expected) { $this->assertEquals($expected, $this->implementation->formatValueForApi($value)); } public function formatValueProvider() { return [ ['string', ['string_value' => 'string']], [true, ['bool_value' => true]], [1, ['number_value' => 1]], [ ['1'], [ 'list_value' => [ 'values' => [ [ 'string_value' => '1' ] ] ] ] ], [ ['test' => 'test'], [ 'struct_value' => [ 'fields' => [ 'test' => [ 'string_value' => 'test' ] ] ] ] ] ]; } /** * @dataProvider unpackValueProvider */ public function testUnpackValue($expected, $value) { $this->assertEquals($expected, $this->implementation->unpackValue($value)); } public function unpackValueProvider() { return [ ['string', ['stringValue' => 'string']], [ ['1'], [ 'listValue' => [ 'values' => [ [ 'stringValue' => '1' ] ] ] ] ], [ [ 'test' =>'test', 'nested' => [ 'test' => 'test' ] ], [ 'structValue' => [ 'fields' => [ 'test' => [ 'stringValue' => 'test' ], 'nested' => [ 'structValue' => [ 'fields' => [ 'test' => [ 'stringValue' => 'test' ] ] ] ] ] ] ] ] ]; } }