Exemplo n.º 1
0
 /**
  * @test
  */
 public function itShouldCreateAClient()
 {
     $reflectionClass = new \ReflectionClass('GingerPayments\\Payment\\Client');
     $reflectionProperty = $reflectionClass->getProperty('httpClient');
     $reflectionProperty->setAccessible(true);
     $client = Ginger::createClient('my-api-key');
     /** @var \GuzzleHttp\Client $httpClient */
     $httpClient = $reflectionProperty->getValue($client);
     $this->assertEquals(str_replace('{version}', Ginger::API_VERSION, Ginger::ENDPOINT), $httpClient->getBaseUrl());
     $this->assertEquals(['User-Agent' => 'ginger-php/' . Ginger::CLIENT_VERSION, 'X-PHP-Version' => PHP_VERSION], $httpClient->getDefaultOption('headers'));
     $this->assertEquals(['my-api-key', ''], $httpClient->getDefaultOption('auth'));
 }
Exemplo n.º 2
0
 /**
  * @test
  */
 public function itShouldCreateAValidUuid()
 {
     $this->assertEquals(Ginger::apiKeyToUuid('f47ac10b58cc4372a5670e02b2c3d479'), 'f47ac10b-58cc-4372-a567-0e02b2c3d479');
 }