Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add presubmit and continuous kokoro tests #5229

Merged
merged 12 commits into from
Apr 21, 2022
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.3'
php-version: '7.4'
ini-values: memory_limit=2048M
- name: Install Dependencies
uses: nick-invision/retry@v1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ env_vars: {
# Configure the docker image for kokoro-trampoline.
env_vars: {
key: "TRAMPOLINE_IMAGE"
value: "gcr.io/cloud-devrel-kokoro-resources/php72"
value: "gcr.io/cloud-devrel-kokoro-resources/php74"
}

# key files from keystore
Expand Down
7 changes: 7 additions & 0 deletions .kokoro/presubmit/php74.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Format: //devtools/kokoro/config/proto/build.proto

# Configure the docker image for kokoro-trampoline.
env_vars: {
key: "TRAMPOLINE_IMAGE"
value: "gcr.io/cloud-devrel-kokoro-resources/php74"
}
4 changes: 2 additions & 2 deletions .kokoro/presubmit/run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ echo "Running Snippet Test Suite"
vendor/bin/phpunit -c phpunit${PHPUNIT_SUFFIX}.xml.dist --verbose --log-junit \
${SNIPPETS_LOG_FILENAME}

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

# Require phpdocumentor:4 for docs generation
Expand Down
3 changes: 2 additions & 1 deletion BigQuery/tests/Unit/QueryResultsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class QueryResultsTest extends TestCase
public $jobId = 'myJobId';
public $queryData = [
'jobComplete' => true,
'jobReference' => ['location' => 123],
'rows' => [
['f' => [['v' => 'Alton'], ['v' => 1]]]
],
Expand Down Expand Up @@ -203,7 +204,7 @@ public function testReloadsInfo()

public function testGetsIdentity()
{
$queryResults = $this->getQueryResults($this->connection);
$queryResults = $this->getQueryResults($this->connection, $this->queryData);

$this->assertEquals($this->jobId, $queryResults->identity()['jobId']);
$this->assertEquals($this->projectId, $queryResults->identity()['projectId']);
Expand Down
2 changes: 1 addition & 1 deletion Core/src/Batch/BatchTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public function send(array $items)
*
* @return array
*/
protected abstract function getCallback();
abstract protected function getCallback();

/**
* @param array $options [optional] {
Expand Down
18 changes: 13 additions & 5 deletions Firestore/tests/Unit/FirestoreSessionHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ public function setUp()
public function testOpen()
{
$this->connection->beginTransaction(['database' => $this->dbName()])
->shouldBeCalledTimes(1);
->shouldBeCalledTimes(1)
->willReturn(['transaction' => null]);
$firestoreSessionHandler = new FirestoreSessionHandler(
$this->connection->reveal(),
$this->valueMapper->reveal(),
Expand Down Expand Up @@ -90,6 +91,9 @@ public function testOpenWithException()
*/
public function testReadNotAllowed()
{
$this->connection->beginTransaction(['database' => $this->dbName()])
->shouldBeCalledTimes(1)
->willReturn(['transaction' => null]);
$firestoreSessionHandler = new FirestoreSessionHandler(
$this->connection->reveal(),
$this->valueMapper->reveal(),
Expand Down Expand Up @@ -124,7 +128,8 @@ public function testReadNothing()
->shouldBeCalledTimes(1)
->willReturn(null);
$this->connection->beginTransaction(['database' => $this->dbName()])
->shouldBeCalledTimes(1);
->shouldBeCalledTimes(1)
->willReturn(['transaction' => null]);
$this->connection->batchGetDocuments([
'database' => $this->dbName(),
'documents' => [$this->documentName()],
Expand All @@ -150,7 +155,8 @@ public function testReadNothing()
public function testReadWithException()
{
$this->connection->beginTransaction(['database' => $this->dbName()])
->shouldBeCalledTimes(1);
->shouldBeCalledTimes(1)
->willReturn(['transaction' => null]);
$this->connection->batchGetDocuments([
'database' => $this->dbName(),
'documents' => [$this->documentName()],
Expand Down Expand Up @@ -186,7 +192,8 @@ public function testReadEntity()
->shouldBeCalledTimes(1)
->willReturn(['data' => 'sessiondata']);
$this->connection->beginTransaction(['database' => $this->dbName()])
->shouldBeCalledTimes(1);
->shouldBeCalledTimes(1)
->willReturn(['transaction' => null]);
$this->connection->batchGetDocuments([
'database' => $this->dbName(),
'documents' => [$this->documentName()],
Expand Down Expand Up @@ -217,7 +224,8 @@ public function testWrite()
return ['data' => ['stringValue' => 'sessiondata']];
});
$this->connection->beginTransaction(['database' => $this->dbName()])
->shouldBeCalledTimes(1);
->shouldBeCalledTimes(1)
->willReturn(['transaction' => null]);
$this->connection->commit([
'database' => $this->dbName(),
'writes' => [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ trait PartitionSharedSnippetTestTrait
private $token = 'token';
private $options = ['hello' => 'world'];

public abstract function setUp();
abstract public function setUp();

/**
* @dataProvider provideSerializeSnippetIndex
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
},
"require-dev": {
"phpunit/phpunit": "^4.8|^5.0",
"squizlabs/php_codesniffer": "2.*",
"squizlabs/php_codesniffer": "3.*",
"phpdocumentor/reflection": "^3.0",
"symfony/console": "^3.0",
"erusev/parsedown": "^1.6",
Expand Down