Пример #1
0
 /**
  * Testing the Client::loadServiceDescription($filepath, $version) method
  *
  * Should fail on invalid types or file paths
  */
 public function testLoadingServiceDescription()
 {
     // Test with a valid Service Description
     $description = $this->client->loadServiceDescription(__DIR__ . '/../src/Description/segment.io.%s.php', $this->client->getConfig('version'));
     $this->assertInstanceOf('GuzzleHttp\\Command\\Guzzle\\Description', $description);
     // Test with a valid file and bad response
     $this->setExpectedException('InvalidArgumentException', 'Invalid Service Description!');
     $this->client->loadServiceDescription(__DIR__ . '/Description/invalid.service.description.%s.php', 'v1');
     // Test with a invalid file path
     $this->setExpectedException('InvalidArgumentException', 'Invalid Service Description!');
     $this->client->loadServiceDescription('foo.%.bar', 'v1');
 }
 /**
  * Tear Down the Test
  *
  * Used to explicitly test the BatchFileSubscriber::__destruct() method
  */
 public function tearDown()
 {
     $file = $this->client->getConfig('file') ?: sys_get_temp_dir() . "/segment-io.log";
     if (file_exists($file)) {
         unlink($file);
     }
     $file = sys_get_temp_dir() . "/segment-io-test2.log";
     if (file_exists($file)) {
         unlink($file);
     }
     unset($this->client);
     unset($this->subscriber);
 }