Skip to content

Commit

Permalink
Add support for read-only transactions and transaction options (#773)
Browse files Browse the repository at this point in the history
  • Loading branch information
jdpedrie authored and dwsupplee committed Jan 31, 2018
1 parent b84cfd6 commit ef18870
Show file tree
Hide file tree
Showing 11 changed files with 1,881 additions and 906 deletions.
2 changes: 1 addition & 1 deletion src/Core/Testing/StubTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function ___getProperty($prop)
public function ___setProperty($prop, $value)
{
if (!in_array($prop, json_decode($this->___props))) {
throw new \BadMethodCallException(sprintf('Property %s cannot be overloaded', $prop));
throw new \RuntimeException(sprintf('Property %s cannot be overloaded', $prop));
}

$property = $this->___getPropertyReflector($prop);
Expand Down
6 changes: 4 additions & 2 deletions src/Core/Testing/TestHelpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,12 @@ public static function stub($extends, array $args = [], array $props = [])

$tpl = 'class %s extends %s {private $___props = \'%s\'; use \Google\Cloud\Core\Testing\StubTrait; }';

$name = 'Stub' . sha1($extends);
$props = json_encode($props);

$name = 'Stub' . sha1($extends . $props);

if (!class_exists($name)) {
eval(sprintf($tpl, $name, $extends, json_encode($props)));
eval(sprintf($tpl, $name, $extends, $props));
}

$reflection = new \ReflectionClass($name);
Expand Down
Loading

0 comments on commit ef18870

Please sign in to comment.