You are here

class ProjectApiTest in TMGMT Translator Smartling 8.4

Same name and namespace in other branches
  1. 8.2 api-sdk-php/tests/unit/ProjectApiTest.php \Smartling\Tests\Unit\ProjectApiTest
  2. 8.2 vendor/smartling/api-sdk-php/tests/unit/ProjectApiTest.php \Smartling\Tests\Unit\ProjectApiTest
  3. 8.3 vendor/smartling/api-sdk-php/tests/unit/ProjectApiTest.php \Smartling\Tests\Unit\ProjectApiTest

Test class for Smartling\Project\ProjectsApi.

Hierarchy

Expanded class hierarchy of ProjectApiTest

File

vendor/smartling/api-sdk-php/tests/unit/ProjectApiTest.php, line 10

Namespace

Smartling\Tests\Unit
View source
class ProjectApiTest extends ApiTestAbstract {

  /**
   * @covers \Smartling\Project\ProjectApi::getProjectDetails
   */
  public function testGetProjectDetails() {
    $endpointUrl = vsprintf('%s/%s/', [
      ProjectApi::ENDPOINT_URL,
      $this->projectId,
    ]);
    $this->client
      ->expects($this
      ->any())
      ->method('request')
      ->with('get', $endpointUrl, [
      'headers' => [
        'Accept' => 'application/json',
        'Authorization' => vsprintf('%s %s', [
          $this->authProvider
            ->getTokenType(),
          $this->authProvider
            ->getAccessToken(),
        ]),
      ],
      'exceptions' => false,
      'query' => [],
    ])
      ->willReturn($this->responseMock);
    $this->object
      ->getProjectDetails();
  }

  /**
   * Sets up the fixture, for example, opens a network connection.
   * This method is called before a test is executed.
   */
  protected function setUp() {
    parent::setUp();
    $this
      ->prepareProjectApiMock();
  }
  private function prepareProjectApiMock() {
    $this->object = $this
      ->getMockBuilder('Smartling\\Project\\ProjectApi')
      ->setMethods(NULL)
      ->setConstructorArgs([
      $this->projectId,
      $this->client,
      null,
      ProjectApi::ENDPOINT_URL,
    ])
      ->getMock();
    $this
      ->invokeMethod($this->object, 'setAuth', [
      $this->authProvider,
    ]);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ApiTestAbstract::$authProvider protected property
ApiTestAbstract::$client protected property
ApiTestAbstract::$clientInterfaceMethods protected static property
ApiTestAbstract::$hasEmitterInterfaceMethods protected static property
ApiTestAbstract::$messageInterfaceMethods protected static property
ApiTestAbstract::$object protected property
ApiTestAbstract::$projectId protected property
ApiTestAbstract::$requestInterfaceMethods protected static property
ApiTestAbstract::$requestMock protected property
ApiTestAbstract::$responseAsync protected property 1
ApiTestAbstract::$responseInterfaceMethods protected static property
ApiTestAbstract::$responseMock protected property
ApiTestAbstract::$responseWithException protected property
ApiTestAbstract::$secretKey protected property
ApiTestAbstract::$streamPlaceholder protected property
ApiTestAbstract::$userIdentifier protected property
ApiTestAbstract::$validResponse protected property
ApiTestAbstract::invokeMethod protected function Invokes protected or private method of given object.
ApiTestAbstract::JSON_OBJECT_AS_ARRAY constant
ApiTestAbstract::prepareAuthProviderMock protected function
ApiTestAbstract::prepareClientResponseMock protected function
ApiTestAbstract::prepareHttpClientMock protected function
ApiTestAbstract::readProperty protected function Reads protected or private property of given object.
ProjectApiTest::prepareProjectApiMock private function
ProjectApiTest::setUp protected function Sets up the fixture, for example, opens a network connection. This method is called before a test is executed. Overrides ApiTestAbstract::setUp
ProjectApiTest::testGetProjectDetails public function @covers \Smartling\Project\ProjectApi::getProjectDetails