Ejemplo n.º 1
0
 private function handleCredentials($value, array &$args)
 {
     // set basic or digest authentication, if needed
     if (isset($args['defaults']['auth']) && count($args['defaults']['auth']) >= 2) {
         $args['client']->setDefaultOption('auth', $args['defaults']['auth']);
     }
     if ($value instanceof CredentialsInterface) {
         return;
     } elseif (is_array($value)) {
         $args['credentials'] = Credentials::factory($value);
     } else {
         throw new InvalidArgumentException('Credentials must be an ' . 'instance of SellerCenter\\SDK\\Common\\Credentials\\CredentialsInterface ' . 'or an associative array that contains API "key" and "secret".');
     }
 }
 public function testToArray()
 {
     $expected = [ConfigEnum::ID => '*****@*****.**', ConfigEnum::KEY => '1b10a679643763478e1a14511024e8b6e971b6c7'];
     $this->assertEquals($expected, $this->credentials->toArray());
 }