/** * @dataProvider allFailDataProvider */ public function testFail($haystack, $required, $optional, $allowUnspecified) { try { v::contains($haystack, $required, $optional, $allowUnspecified); $this->fail('Expected exception not raised.'); } catch (\Exception $e) { return; } }
/** * __construct * * @param array $parameters * @param \Guzzle\Http|Client $httpClient * @param array $httpClientOptions * * @access public * * @return void */ public function __construct(array $parameters, \Guzzle\Http\Client $httpClient = null, $httpClientOptions = array('timeout' => 10)) { try { $required = array('email', 'user-key', 'password'); $optional = array('base-url', 'version', 'output', 'format', 'api-key'); ArrayValidator::contains(array_keys($parameters), $required, $optional, false); $map = new Map($parameters); $this->httpClientOptions = $httpClientOptions; $this->email = $map->get('email'); $this->userKey = $map->get('user-key'); $this->password = $map->get('password'); $this->baseUrl = $map->getWithDefault('base-url', $this->baseUrl); $this->version = $map->getWithDefault('version', $this->version); $this->output = $map->getWithDefault('output', $this->output); $this->format = $map->getWithDefault('format', $this->format); $this->apiKey = $map->getWithDefault('api-key', null); $this->client = null === $httpClient ? $this->getClient() : $httpClient; } catch (Exception $e) { throw new InvalidArgumentException($e->getMessage(), 0, $e); } }