Skip to content

Commit

Permalink
AppsTest#testInstall
Browse files Browse the repository at this point in the history
  • Loading branch information
ecoologic committed Oct 9, 2023
1 parent 83cb7b2 commit b172ff4
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 17 deletions.
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ services:
- vendor:/app/vendor
command: vendor/bin/phpunit --testsuite "Zendesk API Unit Test Suites"
# command: vendor/bin/phpunit --debug --filter testCreateNeedsTicketId tests/Zendesk/API/UnitTests/Core/SatisfactionRatingsTest.php
# command: vendor/bin/phpunit --debug tests/Zendesk/API/UnitTests/Exceptions/ApiResponseExceptionTest.php
# command: vendor/bin/phpunit --debug tests/Zendesk/API/UnitTests/Chat/AppsTest.php

volumes:
vendor:
1 change: 1 addition & 0 deletions src/Zendesk/API/Resources/Chat/Apps.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class Apps extends ResourceAbstract
* @var string
*/
protected $apiBasePath = 'api/chat/';
// TODO: api/v2

/**
* {@inheritdoc}
Expand Down
9 changes: 5 additions & 4 deletions tests/Zendesk/API/UnitTests/BasicTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,17 +185,18 @@ public function assertRequestIs($options, $index = 0)

if (isset($options['apiBasePath'])) {
$this->assertSame(
0,
strpos($request->getUri()->getPath(), $options['apiBasePath']),
"Failed asserting that the API basepath is {$options['apiBasePath']}"
0, strpos($request->getUri()->getPath(), $options['apiBasePath']),
"Failed asserting apiBasePath: expected: {$options['apiBasePath']}, actual: {$request->getUri()->getPath()}"
);
}

if (isset($options['endpoint'])) {
// Truncate the base path from the target, this was added since the existing usage pattern for
// $options['endpoint'] does not include the api/v2 base path
$endpoint = preg_replace('/^' . preg_quote($options['apiBasePath'], '/') . '/', '', $request->getUri()->getPath());
$this->assertEquals($options['endpoint'], $endpoint);
$this->assertEquals(
$options['endpoint'], $endpoint,
"Failed asserting endpoint: expected: {$options['endpoint']}, actual: {$endpoint}");
}

if (isset($options['queryParams'])) {
Expand Down
13 changes: 2 additions & 11 deletions tests/Zendesk/API/UnitTests/Chat/AppsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,10 @@ class AppsTest extends BasicTest
*/
public function testInstall()
{
$this->markTestSkipped('CBP TODO assert');
// 1) Zendesk\API\UnitTests\Chat\AppsTest::testInstall
// Failed asserting that the API basepath is /api/chat/
// Failed asserting that false is identical to 0.
// /app/tests/Zendesk/API/UnitTests/BasicTest.php:190
// /app/tests/Zendesk/API/UnitTests/BasicTest.php:120
// /app/tests/Zendesk/API/UnitTests/BasicTest.php:233
// /app/tests/Zendesk/API/UnitTests/Chat/AppsTest.php:31
// phpvfscomposer:///app/vendor/phpunit/phpunit/phpunit:35

$faker = Factory::create();
$postFields = [
'app_id' => $faker->numberBetween(1),
'product_name' => 'chat',
'settings' =>
[
'name' => $faker->word,
Expand All @@ -36,7 +27,7 @@ public function testInstall()
$this->client->chat->apps()->install($postFields);
}, 'apps/installations.json', 'POST', [
'postFields' => $postFields,
'apiBasePath' => '/api/chat/',
'apiBasePath' => '/api/v2/'
]);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ function () use ($ticketId, $postParams) {
);
}


/**
* Test the create method requires a ticket id
*/
Expand Down

0 comments on commit b172ff4

Please sign in to comment.