|
25 | 25 | use GuzzleHttp\HandlerStack; |
26 | 26 | use GuzzleHttp\Psr7\Response; |
27 | 27 | use Psr\Log\NullLogger; |
| 28 | +use Symfony\Component\Cache\Adapter\ArrayAdapter; |
28 | 29 | use Symfony\Component\EventDispatcher\EventDispatcher; |
29 | 30 |
|
30 | 31 | class CourseProviderTest extends ApiTestCase |
@@ -1773,6 +1774,28 @@ public function testGetCourseEventByIdentifier(): void |
1773 | 1774 | $this->assertSame('CLASS', $courseEvent->getTypeKey()); |
1774 | 1775 | } |
1775 | 1776 |
|
| 1777 | + public function testCampusononlineApiTokenCache(): void |
| 1778 | + { |
| 1779 | + $this->courseProvider->setCampusonlineApiCacheItemPool(new ArrayAdapter()); |
| 1780 | + |
| 1781 | + $this->mockResponses([ |
| 1782 | + new Response(200, ['Content-Type' => 'application/json;charset=utf-8'], |
| 1783 | + file_get_contents(__DIR__.'/appointment_api_item_response.json')), |
| 1784 | + ]); |
| 1785 | + $courseEvent = $this->courseProvider->getCourseEventById('1'); |
| 1786 | + $this->assertSame('1', $courseEvent->getIdentifier()); |
| 1787 | + |
| 1788 | + $this->courseProvider->reset(); // reset request (in-memory) cache |
| 1789 | + |
| 1790 | + $this->mockResponses([ |
| 1791 | + new Response(200, ['Content-Type' => 'application/json;charset=utf-8'], |
| 1792 | + file_get_contents(__DIR__.'/appointment_api_item_response.json')), |
| 1793 | + ], mockAuthServerResponses: false |
| 1794 | + ); |
| 1795 | + $courseEvent = $this->courseProvider->getCourseEventById('1'); |
| 1796 | + $this->assertSame('1', $courseEvent->getIdentifier()); |
| 1797 | + } |
| 1798 | + |
1776 | 1799 | public function testGetCourseEventByIdentifierNotFound(): void |
1777 | 1800 | { |
1778 | 1801 | $this->mockResponses([ |
|
0 commit comments