Skip to content
Merged
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
4 changes: 2 additions & 2 deletions src/BigQuery/Dataset.php
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ public function createTable($id, array $options = [])
* Example:
* ```
* $info = $dataset->info();
* echo $info['friendlyName'];
* echo $info['selfLink'];
* ```
*
* @see https://cloud.google.com/bigquery/docs/reference/v2/datasets#resource Datasets resource documentation.
Expand All @@ -290,7 +290,7 @@ public function info(array $options = [])
* ```
* $dataset->reload();
* $info = $dataset->info();
* echo $info['friendlyName'];
* echo $info['selfLink'];
* ```
*
* @see https://cloud.google.com/bigquery/docs/reference/v2/datasets/get Datasets get API documentation.
Expand Down
4 changes: 2 additions & 2 deletions src/BigQuery/Table.php
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ public function insertRows(array $rows, array $options = [])
* Example:
* ```
* $info = $table->info();
* echo $info['friendlyName'];
* echo $info['selfLink'];
* ```
*
* @see https://cloud.google.com/bigquery/docs/reference/v2/tables#resource Tables resource documentation.
Expand All @@ -563,7 +563,7 @@ public function info(array $options = [])
* ```
* $table->reload();
* $info = $table->info();
* echo $info['friendlyName'];
* echo $info['selfLink'];
* ```
*
* @see https://cloud.google.com/bigquery/docs/reference/v2/tables/get Tables get API documentation.
Expand Down
12 changes: 6 additions & 6 deletions tests/snippets/BigQuery/DatasetTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,27 +136,27 @@ public function testCreateTable()

public function testInfo()
{
$friendlyName = 'Friendly.';
$dataset = $this->getDataset($this->connection, ['friendlyName' => $friendlyName]);
$selfLink = 'https://www.googleapis.com/bigquery/v2/projects/my-project/datasets/mynewdataset';
$dataset = $this->getDataset($this->connection, ['selfLink' => $selfLink]);
$snippet = $this->snippetFromMethod(Dataset::class, 'info');
$snippet->addLocal('dataset', $dataset);
$res = $snippet->invoke();

$this->assertEquals($friendlyName, $res->output());
$this->assertEquals($selfLink, $res->output());
}

public function testReload()
{
$friendlyName = 'Friendly.';
$selfLink = 'https://www.googleapis.com/bigquery/v2/projects/my-project/datasets/mynewdataset';
$this->connection->getDataset(Argument::any())
->shouldBeCalledTimes(1)
->willReturn(['friendlyName' => $friendlyName]);
->willReturn(['selfLink' => $selfLink]);
$dataset = $this->getDataset($this->connection);
$snippet = $this->snippetFromMethod(Dataset::class, 'reload');
$snippet->addLocal('dataset', $dataset);
$res = $snippet->invoke();

$this->assertEquals($friendlyName, $res->output());
$this->assertEquals($selfLink, $res->output());
}

public function testId()
Expand Down
9 changes: 5 additions & 4 deletions tests/snippets/BigQuery/TableTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ public function setUp()
]
]
],
'friendlyName' => 'Jeffrey'
'friendlyName' => 'Jeffrey',
'selfLink' => 'https://www.googleapis.com/bigquery/v2/projects/my-project/datasets/mynewdataset',
];

$this->mapper = new ValueMapper(false);
Expand Down Expand Up @@ -274,7 +275,7 @@ public function testInfo()
$snippet->addLocal('table', $this->table);

$res = $snippet->invoke();
$this->assertEquals('Jeffrey', $res->output());
$this->assertEquals('https://www.googleapis.com/bigquery/v2/projects/my-project/datasets/mynewdataset', $res->output());
}

public function testReload()
Expand All @@ -285,13 +286,13 @@ public function testReload()
$this->connection->getTable(Argument::any())
->shouldBeCalled()
->willReturn([
'friendlyName' => 'El Jefe'
'selfLink' => 'https://www.googleapis.com/bigquery/v2/projects/my-project/datasets/myupdateddataset'
]);

$this->table->___setProperty('connection', $this->connection->reveal());

$res = $snippet->invoke();
$this->assertEquals('El Jefe', $res->output());
$this->assertEquals('https://www.googleapis.com/bigquery/v2/projects/my-project/datasets/myupdateddataset', $res->output());
}

public function testId()
Expand Down