forked from biblioverse/biblioteca
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(kobo): Display device name to test the param converter
- Loading branch information
Showing
3 changed files
with
62 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
|
||
namespace App\Tests\Controller\Kobo; | ||
|
||
use Symfony\Component\HttpFoundation\Request; | ||
use Symfony\Bundle\FrameworkBundle\KernelBrowser; | ||
|
||
class ApiEndpointControllerTest extends AbstractKoboControllerTest | ||
{ | ||
public function testIndex(): void | ||
{ | ||
$client = static::getClient(); | ||
if(!$client instanceof KernelBrowser){ | ||
self::markTestSkipped('Profiler is not available'); | ||
} | ||
|
||
$this->injectFakeFileSystemManager(); | ||
|
||
$client->enableProfiler(); | ||
$client->request(Request::METHOD_GET, '/kobo/'.$this->accessKey."/"); | ||
self::assertResponseIsSuccessful(); | ||
|
||
// Setup does 2 requests: | ||
// - Select kobo device by accessKey | ||
// - Select Book by id | ||
// ----------------------- | ||
// 4 requests are made for the endpoint | ||
// - 1) Select KoboDevice by access key | ||
// - 2) begin transaction | ||
// - 3) Update user's last_login | ||
// - 4) commit transaction | ||
// We check that the number of queries is as expected | ||
self::assertLessThanOrEqual( | ||
2 + 4, | ||
$this->getNumberOfQueries($client) | ||
); | ||
} | ||
} |