public function testGrantToWithUserSpec() { $specOn = UserSpecification::createWithFormat(NULL, 'localuser@localhost'); $specTo = UserSpecification::createWithFormat(NULL, 'externaluser@somehost'); $q = new GrantQuery(); $q->grant('PROXY')->on($specOn)->to($specTo); $this->assertSql('GRANT PROXY ON `localuser`@`localhost` TO `externaluser`@`somehost`', $q); }
public function user($spec = NULL) { $user = NULL; if (is_string($spec) && ($user = UserSpecification::createWithFormat($this, $spec))) { $this->userSpecifications[] = $user; } else { $this->userSpecifications[] = $user = new UserSpecification($this); } return $user; }
public function to($spec) { if ($spec instanceof UserSpecification) { $this->to[] = $spec; } elseif (strpos($spec, '@') !== false) { $user = UserSpecification::createWithFormat($this, $spec); $this->to[] = $user; } else { throw new InvalidArgumentException("Unsupported user specification: {$spec}"); } return $this; }
public function _for($userspec) { $this->for = UserSpecification::createWithFormat($this, $userspec); return $this; }
/** * @expectedException BadMethodCallException */ public function testBadMethodCall() { $spec = new UserSpecification(NULL); $spec->foo(); }