Skip to content

Commit

Permalink
Skip Spanner tests that use gRPC
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelbausor committed Jun 22, 2017
1 parent f8d50cc commit 5921244
Show file tree
Hide file tree
Showing 14 changed files with 70 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tests/unit/Core/GPBGrpcRequestWrapperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ function ($test, $options) use ($response, $requestOptions) {

public function responseProvider()
{
if ($this->shouldSkipGrpcTests()) {
return [];
}
$expectedMessage = ['successful' => 'request'];
$message = $this->prophesize(Message::class);
$serializer = $this->prophesize(Serializer::class);
Expand Down
8 changes: 8 additions & 0 deletions tests/unit/Spanner/BytesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,22 @@
namespace Google\Cloud\Tests\Unit\Spanner;

use Google\Cloud\Spanner\Bytes;
use Google\Cloud\Tests\GrpcTestTrait;

/**
* @group spanner
*/
class BytesTest extends \PHPUnit_Framework_TestCase
{
use GrpcTestTrait;

private $content = 'hello';

public function setUp()
{
$this->checkAndSkipGrpcTests();
}

public function testGet()
{
$bytes = new Bytes($this->content);
Expand Down
5 changes: 5 additions & 0 deletions tests/unit/Spanner/DatabaseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,16 @@
use Google\Cloud\Spanner\Timestamp;
use Google\Cloud\Spanner\Transaction;
use Google\Cloud\Spanner\ValueMapper;
use Google\Cloud\Tests\GrpcTestTrait;
use Prophecy\Argument;

/**
* @group spanner
*/
class DatabaseTest extends \PHPUnit_Framework_TestCase
{
use GrpcTestTrait;

const PROJECT = 'my-awesome-project';
const DATABASE = 'my-database';
const INSTANCE = 'my-instance';
Expand All @@ -58,6 +61,8 @@ class DatabaseTest extends \PHPUnit_Framework_TestCase

public function setUp()
{
$this->checkAndSkipGrpcTests();

$this->connection = $this->prophesize(ConnectionInterface::class);
$this->instance = $this->prophesize(Instance::class);
$this->sessionPool = $this->prophesize(SessionPoolInterface::class);
Expand Down
5 changes: 5 additions & 0 deletions tests/unit/Spanner/DateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,22 @@
namespace Google\Cloud\Tests\Unit\Spanner;

use Google\Cloud\Spanner\Date;
use Google\Cloud\Tests\GrpcTestTrait;

/**
* @group spanner
*/
class DateTest extends \PHPUnit_Framework_TestCase
{
use GrpcTestTrait;

private $dt;
private $date;

public function setUp()
{
$this->checkAndSkipGrpcTests();

$this->dt = new \DateTime('1989-10-11');
$this->date = new Date($this->dt);
}
Expand Down
5 changes: 5 additions & 0 deletions tests/unit/Spanner/InstanceConfigurationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
use Google\Cloud\Spanner\Admin\Instance\V1\InstanceAdminClient;
use Google\Cloud\Spanner\InstanceConfiguration;
use Google\Cloud\Spanner\Connection\ConnectionInterface;
use Google\Cloud\Tests\GrpcTestTrait;
use Prophecy\Argument;

/**
Expand All @@ -29,6 +30,8 @@
*/
class InstanceConfigurationTest extends \PHPUnit_Framework_TestCase
{
use GrpcTestTrait;

const PROJECT_ID = 'test-project';
const NAME = 'test-config';

Expand All @@ -37,6 +40,8 @@ class InstanceConfigurationTest extends \PHPUnit_Framework_TestCase

public function setUp()
{
$this->checkAndSkipGrpcTests();

$this->connection = $this->prophesize(ConnectionInterface::class);
$this->configuration = \Google\Cloud\Dev\stub(InstanceConfiguration::class, [
$this->connection->reveal(),
Expand Down
5 changes: 5 additions & 0 deletions tests/unit/Spanner/InstanceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
use Google\Cloud\Spanner\Database;
use Google\Cloud\Spanner\Instance;
use Google\Cloud\Spanner\Session\SessionPoolInterface;
use Google\Cloud\Tests\GrpcTestTrait;
use Prophecy\Argument;

/**
Expand All @@ -37,6 +38,8 @@
*/
class InstanceTest extends \PHPUnit_Framework_TestCase
{
use GrpcTestTrait;

const PROJECT_ID = 'test-project';
const NAME = 'instance-name';

Expand All @@ -45,6 +48,8 @@ class InstanceTest extends \PHPUnit_Framework_TestCase

public function setUp()
{
$this->checkAndSkipGrpcTests();

$this->connection = $this->prophesize(ConnectionInterface::class);
$this->instance = \Google\Cloud\Dev\stub(Instance::class, [
$this->connection->reveal(),
Expand Down
5 changes: 5 additions & 0 deletions tests/unit/Spanner/KeyRangeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,21 @@
namespace Google\Cloud\Tests\Unit\Spanner;

use Google\Cloud\Spanner\KeyRange;
use Google\Cloud\Tests\GrpcTestTrait;

/**
* @group spanner
*/
class KeyRangeTest extends \PHPUnit_Framework_TestCase
{
use GrpcTestTrait;

private $range;

public function setUp()
{
$this->checkAndSkipGrpcTests();

$this->range = new KeyRange;
}

Expand Down
5 changes: 5 additions & 0 deletions tests/unit/Spanner/OperationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,16 @@
use Google\Cloud\Spanner\Timestamp;
use Google\Cloud\Spanner\Transaction;
use Google\Cloud\Spanner\ValueMapper;
use Google\Cloud\Tests\GrpcTestTrait;
use Prophecy\Argument;

/**
* @group spanner
*/
class OperationTest extends \PHPUnit_Framework_TestCase
{
use GrpcTestTrait;

const SESSION = 'my-session-id';
const TRANSACTION = 'my-transaction-id';
const DATABASE = 'my-database';
Expand All @@ -47,6 +50,8 @@ class OperationTest extends \PHPUnit_Framework_TestCase

public function setUp()
{
$this->checkAndSkipGrpcTests();

$this->connection = $this->prophesize(ConnectionInterface::class);

$this->operation = \Google\Cloud\Dev\stub(Operation::class, [
Expand Down
5 changes: 5 additions & 0 deletions tests/unit/Spanner/SnapshotTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,23 @@
use Google\Cloud\Spanner\Session\Session;
use Google\Cloud\Spanner\Snapshot;
use Google\Cloud\Spanner\Timestamp;
use Google\Cloud\Tests\GrpcTestTrait;
use Prophecy\Argument;

/**
* @group spanner
*/
class SnapshotTest extends \PHPUnit_Framework_TestCase
{
use GrpcTestTrait;

private $timestamp;
private $snapshot;

public function setUp()
{
$this->checkAndSkipGrpcTests();

$this->timestamp = new Timestamp(new \DateTime);

$args = [
Expand Down
5 changes: 5 additions & 0 deletions tests/unit/Spanner/TimestampTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,22 @@
namespace Google\Cloud\Tests\Unit\Spanner;

use Google\Cloud\Spanner\Timestamp;
use Google\Cloud\Tests\GrpcTestTrait;

/**
* @group spanner
*/
class TimestampTest extends \PHPUnit_Framework_TestCase
{
use GrpcTestTrait;

private $dt;
private $ts;

public function setUp()
{
$this->checkAndSkipGrpcTests();

$this->dt = new \DateTime('1989-10-11 08:58:00 +00:00');
$this->ts = new Timestamp($this->dt);
}
Expand Down
5 changes: 5 additions & 0 deletions tests/unit/Spanner/TransactionConfigurationTraitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,15 @@
use Google\Cloud\Spanner\Session\SessionPoolInterface;
use Google\Cloud\Spanner\Timestamp;
use Google\Cloud\Spanner\TransactionConfigurationTrait;
use Google\Cloud\Tests\GrpcTestTrait;

/**
* @group spanner
*/
class TransactionConfigurationTraitTest extends \PHPUnit_Framework_TestCase
{
use GrpcTestTrait;

const TRANSACTION = 'my-transaction';
const TIMESTAMP = '2017-01-09T18:05:22.534799Z';
const NANOS = '534799';
Expand All @@ -38,6 +41,8 @@ class TransactionConfigurationTraitTest extends \PHPUnit_Framework_TestCase

public function setUp()
{
$this->checkAndSkipGrpcTests();

$this->impl = new TransactionConfigurationTraitImplementation;
$this->ts = new Timestamp(new \DateTime(self::TIMESTAMP), self::NANOS);
$this->duration = new Duration(10,1);
Expand Down
5 changes: 5 additions & 0 deletions tests/unit/Spanner/TransactionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,16 @@
use Google\Cloud\Spanner\Timestamp;
use Google\Cloud\Spanner\Transaction;
use Google\Cloud\Spanner\ValueMapper;
use Google\Cloud\Tests\GrpcTestTrait;
use Prophecy\Argument;

/**
* @group spanner
*/
class TransactionTest extends \PHPUnit_Framework_TestCase
{
use GrpcTestTrait;

const TIMESTAMP = '2017-01-09T18:05:22.534799Z';

const PROJECT = 'my-awesome-project';
Expand All @@ -53,6 +56,8 @@ class TransactionTest extends \PHPUnit_Framework_TestCase

public function setUp()
{
$this->checkAndSkipGrpcTests();

$this->connection = $this->prophesize(ConnectionInterface::class);
$this->operation = new Operation($this->connection->reveal(), false);

Expand Down
5 changes: 5 additions & 0 deletions tests/unit/Spanner/TransactionTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,16 @@
use Google\Cloud\Spanner\Timestamp;
use Google\Cloud\Spanner\Transaction;
use Google\Cloud\Spanner\V1\SpannerClient;
use Google\Cloud\Tests\GrpcTestTrait;
use Prophecy\Argument;

/**
* @group spanner
*/
class TransactionTypeTest extends \PHPUnit_Framework_TestCase
{
use GrpcTestTrait;

use ResultTestTrait;

const PROJECT = 'my-project';
Expand All @@ -51,6 +54,8 @@ class TransactionTypeTest extends \PHPUnit_Framework_TestCase

public function setUp()
{
$this->checkAndSkipGrpcTests();

$this->timestamp = (new \DateTimeImmutable)->format(Timestamp::FORMAT);

$this->connection = $this->prophesize(ConnectionInterface::class);
Expand Down
4 changes: 4 additions & 0 deletions tests/unit/Spanner/ValueMapperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,22 @@
use Google\Cloud\Spanner\Result;
use Google\Cloud\Spanner\Timestamp;
use Google\Cloud\Spanner\ValueMapper;
use Google\Cloud\Tests\GrpcTestTrait;

/**
* @group spanner
*/
class ValueMapperTest extends \PHPUnit_Framework_TestCase
{
use GrpcTestTrait;

const FORMAT_TEST_VALUE = 'abc';

private $mapper;

public function setUp()
{
$this->checkAndSkipGrpcTests();
$this->mapper = new ValueMapper(false);
}

Expand Down

0 comments on commit 5921244

Please sign in to comment.