You are here

class ProjectApiTest in TMGMT Translator Smartling 8.2

Same name in this branch
  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
Same name and namespace in other branches
  1. 8.4 vendor/smartling/api-sdk-php/tests/unit/ProjectApiTest.php \Smartling\Tests\Unit\ProjectApiTest
  2. 8.3 vendor/smartling/api-sdk-php/tests/unit/ProjectApiTest.php \Smartling\Tests\Unit\ProjectApiTest

Test class for Smartling\Project\ProjectsApi.

Hierarchy

  • class \Smartling\Tests\Unit\ProjectApiTest extends \Smartling\Tests\Unit\ApiTestAbstract

Expanded class hierarchy of ProjectApiTest

File

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
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.
ProjectApiTest::testGetProjectDetails public function @covers \Smartling\Project\ProjectApi::getProjectDetails