Skip to content

Commit edce5c0

Browse files
authored
chore: add presubmit and continuous kokoro tests (#5229)
* chore: add kokoro configs for running tests on PHP 7.4 and 8.0 * update PHP version for docs * use php80 for continuous tests * update kokoro to ues php 8 for docs gen * update cs library and fix cs * hopefully fix tests * Revert "hopefully fix tests" This reverts commit 60fe138. * fix tests for PHP 7.4 * Update docs.yml * remove 8.0
1 parent b7c3197 commit edce5c0

9 files changed

Lines changed: 29 additions & 13 deletions

File tree

.github/workflows/docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
- name: Setup PHP
2222
uses: shivammathur/setup-php@v2
2323
with:
24-
php-version: '7.3'
24+
php-version: '7.4'
2525
ini-values: memory_limit=2048M
2626
- name: Install Dependencies
2727
uses: nick-invision/retry@v1
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ env_vars: {
1515
# Configure the docker image for kokoro-trampoline.
1616
env_vars: {
1717
key: "TRAMPOLINE_IMAGE"
18-
value: "gcr.io/cloud-devrel-kokoro-resources/php72"
18+
value: "gcr.io/cloud-devrel-kokoro-resources/php74"
1919
}
2020

2121
# key files from keystore

.kokoro/presubmit/php74.cfg

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Format: //devtools/kokoro/config/proto/build.proto
2+
3+
# Configure the docker image for kokoro-trampoline.
4+
env_vars: {
5+
key: "TRAMPOLINE_IMAGE"
6+
value: "gcr.io/cloud-devrel-kokoro-resources/php74"
7+
}

.kokoro/presubmit/run-tests.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ echo "Running Snippet Test Suite"
4545
vendor/bin/phpunit -c phpunit${PHPUNIT_SUFFIX}.xml.dist --verbose --log-junit \
4646
${SNIPPETS_LOG_FILENAME}
4747

48-
# Run docs gen on PHP 7.3 only
49-
if [ "7.3" == ${PHP_VERSION:0:3} ]; then
48+
# Run docs gen on PHP 7.4 only
49+
if [ "7.4" == ${PHP_VERSION:0:3} ]; then
5050
echo "Running Doc Generator"
5151

5252
# Require phpdocumentor:4 for docs generation

BigQuery/tests/Unit/QueryResultsTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ class QueryResultsTest extends TestCase
3636
public $jobId = 'myJobId';
3737
public $queryData = [
3838
'jobComplete' => true,
39+
'jobReference' => ['location' => 123],
3940
'rows' => [
4041
['f' => [['v' => 'Alton'], ['v' => 1]]]
4142
],
@@ -203,7 +204,7 @@ public function testReloadsInfo()
203204

204205
public function testGetsIdentity()
205206
{
206-
$queryResults = $this->getQueryResults($this->connection);
207+
$queryResults = $this->getQueryResults($this->connection, $this->queryData);
207208

208209
$this->assertEquals($this->jobId, $queryResults->identity()['jobId']);
209210
$this->assertEquals($this->projectId, $queryResults->identity()['projectId']);

Core/src/Batch/BatchTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ public function send(array $items)
130130
*
131131
* @return array
132132
*/
133-
protected abstract function getCallback();
133+
abstract protected function getCallback();
134134

135135
/**
136136
* @param array $options [optional] {

Firestore/tests/Unit/FirestoreSessionHandlerTest.php

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ public function setUp()
5656
public function testOpen()
5757
{
5858
$this->connection->beginTransaction(['database' => $this->dbName()])
59-
->shouldBeCalledTimes(1);
59+
->shouldBeCalledTimes(1)
60+
->willReturn(['transaction' => null]);
6061
$firestoreSessionHandler = new FirestoreSessionHandler(
6162
$this->connection->reveal(),
6263
$this->valueMapper->reveal(),
@@ -90,6 +91,9 @@ public function testOpenWithException()
9091
*/
9192
public function testReadNotAllowed()
9293
{
94+
$this->connection->beginTransaction(['database' => $this->dbName()])
95+
->shouldBeCalledTimes(1)
96+
->willReturn(['transaction' => null]);
9397
$firestoreSessionHandler = new FirestoreSessionHandler(
9498
$this->connection->reveal(),
9599
$this->valueMapper->reveal(),
@@ -124,7 +128,8 @@ public function testReadNothing()
124128
->shouldBeCalledTimes(1)
125129
->willReturn(null);
126130
$this->connection->beginTransaction(['database' => $this->dbName()])
127-
->shouldBeCalledTimes(1);
131+
->shouldBeCalledTimes(1)
132+
->willReturn(['transaction' => null]);
128133
$this->connection->batchGetDocuments([
129134
'database' => $this->dbName(),
130135
'documents' => [$this->documentName()],
@@ -150,7 +155,8 @@ public function testReadNothing()
150155
public function testReadWithException()
151156
{
152157
$this->connection->beginTransaction(['database' => $this->dbName()])
153-
->shouldBeCalledTimes(1);
158+
->shouldBeCalledTimes(1)
159+
->willReturn(['transaction' => null]);
154160
$this->connection->batchGetDocuments([
155161
'database' => $this->dbName(),
156162
'documents' => [$this->documentName()],
@@ -186,7 +192,8 @@ public function testReadEntity()
186192
->shouldBeCalledTimes(1)
187193
->willReturn(['data' => 'sessiondata']);
188194
$this->connection->beginTransaction(['database' => $this->dbName()])
189-
->shouldBeCalledTimes(1);
195+
->shouldBeCalledTimes(1)
196+
->willReturn(['transaction' => null]);
190197
$this->connection->batchGetDocuments([
191198
'database' => $this->dbName(),
192199
'documents' => [$this->documentName()],
@@ -217,7 +224,8 @@ public function testWrite()
217224
return ['data' => ['stringValue' => 'sessiondata']];
218225
});
219226
$this->connection->beginTransaction(['database' => $this->dbName()])
220-
->shouldBeCalledTimes(1);
227+
->shouldBeCalledTimes(1)
228+
->willReturn(['transaction' => null]);
221229
$this->connection->commit([
222230
'database' => $this->dbName(),
223231
'writes' => [

Spanner/tests/Snippet/Batch/PartitionSharedSnippetTestTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ trait PartitionSharedSnippetTestTrait
2626
private $token = 'token';
2727
private $options = ['hello' => 'world'];
2828

29-
public abstract function setUp();
29+
abstract public function setUp();
3030

3131
/**
3232
* @dataProvider provideSerializeSnippetIndex

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
},
5858
"require-dev": {
5959
"phpunit/phpunit": "^4.8|^5.0",
60-
"squizlabs/php_codesniffer": "2.*",
60+
"squizlabs/php_codesniffer": "3.*",
6161
"phpdocumentor/reflection": "^3.0",
6262
"symfony/console": "^3.0",
6363
"erusev/parsedown": "^1.6",

0 commit comments

Comments
 (0)