github.com/phrase/openapi@v0.0.0-20240514140800-49e8a106740e/clients/php/test/Api/KeysApiTest.php (about)

     1  <?php
     2  /**
     3   * KeysApiTest
     4   * PHP version 5
     5   *
     6   * @category Class
     7   * @package  Phrase
     8   * @author   OpenAPI Generator team
     9   * @link     https://openapi-generator.tech
    10   */
    11  
    12  /**
    13   * Phrase Strings API Reference
    14   *
    15   * The version of the OpenAPI document: 2.0.0
    16   * Contact: support@phrase.com
    17   * Generated by: https://openapi-generator.tech
    18   * OpenAPI Generator version: 7.0.1
    19   */
    20  
    21  /**
    22   * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
    23   * https://openapi-generator.tech
    24   * Please update the test case below to test the endpoint.
    25   */
    26  
    27  namespace Phrase;
    28  
    29  use \Phrase\Configuration as Configuration;
    30  use \Phrase\ApiException;
    31  use \Phrase\ObjectSerializer;
    32  use PHPUnit\Framework\TestCase;
    33  
    34  use \Phrase\Api\KeysApi as Api;
    35  
    36  use GuzzleHttp\Client;
    37  use GuzzleHttp\Handler\MockHandler;
    38  use GuzzleHttp\HandlerStack;
    39  use GuzzleHttp\Middleware;
    40  use GuzzleHttp\Psr7\Response;
    41  
    42  /**
    43   * KeysApiTest Class Doc Comment
    44   *
    45   * @category Class
    46   * @package  Phrase
    47   * @author   OpenAPI Generator team
    48   * @link     https://openapi-generator.tech
    49   */
    50  class KeysApiTest extends TestCase
    51  {
    52      private $apiInstance;
    53      private $mock;
    54      private $history = [];
    55  
    56      /**
    57       * Setup before running any test cases
    58       */
    59      public static function setUpBeforeClass()
    60      {
    61      }
    62  
    63      /**
    64       * Setup before running each test case
    65       */
    66      public function setUp()
    67      {
    68          $this->mock = new MockHandler();
    69          $history = Middleware::history($this->history);
    70          $handlerStack = HandlerStack::create($this->mock);
    71          $handlerStack->push($history);
    72          $client = new Client(['handler' => $handlerStack]);
    73  
    74          $config = Configuration::getDefaultConfiguration()->setApiKey('Authorization', 'YOUR_API_KEY');
    75          $config = Configuration::getDefaultConfiguration()->setApiKeyPrefix('Authorization', 'token');
    76  
    77          $this->apiInstance = new Api($client, $config);
    78      }
    79  
    80      /**
    81       * Clean up after running each test case
    82       */
    83      public function tearDown()
    84      {
    85      }
    86  
    87      /**
    88       * Clean up after running all test cases
    89       */
    90      public static function tearDownAfterClass()
    91      {
    92      }
    93  
    94      /**
    95       * Test case for keyCreate
    96       *
    97       * Create a key.
    98       *
    99       */
   100      public function testKeyCreate()
   101      {
   102      }
   103  
   104      /**
   105       * Test case for keyDelete
   106       *
   107       * Delete a key.
   108       *
   109       */
   110      public function testKeyDelete()
   111      {
   112      }
   113  
   114      /**
   115       * Test case for keyShow
   116       *
   117       * Get a single key.
   118       *
   119       */
   120      public function testKeyShow()
   121      {
   122          $this->mock->append(new Response(200, [], '{"id":"KEY_ID","name":"five","description":null,"name_hash":"NAME_HASH","plural":false,"tags":["upload-20231101_143051","fas"],"default_translation_content":"","created_at":"2023-11-01T14:31:01Z","updated_at":"2024-03-20T21:10:44Z","name_plural":null,"comments_count":0,"data_type":"string","max_characters_allowed":0,"screenshot_url":null,"unformatted":false,"xml_space_preserve":false,"original_file":null,"format_value_type":null,"localized_format_key":null,"localized_format_string":null,"custom_metadata":{"Name":"my name"},"creator":{"id":"CREATOR_ID","username":"username","name":"NAME","gravatar_uid":"UID"}}'));
   123  
   124          $projectId = "project_id_example";
   125          $id = "key_id";
   126          $result = $this->apiInstance->keyShow($projectId, $id);
   127  
   128          $this->assertNotNull($result);
   129          $this->assertInstanceOf('\Phrase\Model\TranslationKeyDetails', $result);
   130          $this->assertEquals('KEY_ID', $result->getId());
   131          $this->assertEquals('five', $result->getName());
   132          $this->assertEquals('my name', $result->getCustomMetadata()['Name']);
   133  
   134          $lastRequest = $this->history[count($this->history)-1]['request'];
   135          $this->assertEquals('GET', $lastRequest->getMethod());
   136          $this->assertEquals('/v2/projects/'.$projectId.'/keys/'.$id, $lastRequest->getUri()->getPath());
   137      }
   138  
   139      /**
   140       * Test case for keyUpdate
   141       *
   142       * Update a key.
   143       *
   144       */
   145      public function testKeyUpdate()
   146      {
   147      }
   148  
   149      /**
   150       * Test case for keysDeleteCollection
   151       *
   152       * Delete collection of keys.
   153       *
   154       */
   155      public function testKeysDeleteCollection()
   156      {
   157      }
   158  
   159      /**
   160       * Test case for keysExclude
   161       *
   162       * Exclude a locale on a collection of keys.
   163       *
   164       */
   165      public function testKeysExclude()
   166      {
   167      }
   168  
   169      /**
   170       * Test case for keysInclude
   171       *
   172       * Include a locale on a collection of keys.
   173       *
   174       */
   175      public function testKeysInclude()
   176      {
   177      }
   178  
   179      /**
   180       * Test case for keysList
   181       *
   182       * List keys.
   183       *
   184       */
   185      public function testKeysList()
   186      {
   187      }
   188  
   189      /**
   190       * Test case for keysSearch
   191       *
   192       * Search keys.
   193       *
   194       */
   195      public function testKeysSearch()
   196      {
   197      }
   198  
   199      /**
   200       * Test case for keysTag
   201       *
   202       * Add tags to collection of keys.
   203       *
   204       */
   205      public function testKeysTag()
   206      {
   207      }
   208  
   209      /**
   210       * Test case for keysUntag
   211       *
   212       * Remove tags from collection of keys.
   213       *
   214       */
   215      public function testKeysUntag()
   216      {
   217      }
   218  }