ILIAS  trunk Revision v12.0_alpha-1540-g00f839d5fa1
FlashcardManagerTest.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
23use PHPUnit\Framework\TestCase;
27
28class FlashcardManagerTest extends TestCase
29{
30 protected function getManagerMock(): FlashcardManager
31 {
32 $domain = $this->getMockBuilder(InternalDomainService::class)->disableOriginalConstructor()->getMock();
33 $repo = $this->getMockBuilder(InternalRepoServiceInterface::class)->disableOriginalConstructor()->getMock();
34
35 return new class ($domain, $repo, 11, 99) extends FlashcardManager {
36 public function __construct(
37 InternalDomainService $domain_service,
39 int $glo_ref_id,
40 int $user_id
41 ) {
42 $this->domain = $domain_service;
43 $this->glo_id = $glo_ref_id;
44 $this->user_id = $user_id;
45 $this->session_repo = new FlashcardSessionArrayRepository();
46 }
47 };
48 }
49
50 public function testSetSessionInitialTerms(): void
51 {
52 $manager = $this->getManagerMock();
53 $terms = [123, 456, 789];
54
55 $manager->setSessionInitialTerms(55, $terms);
56
57 $this->assertSame($terms, $manager->getSessionInitialTerms(55));
58 }
59
60 public function testSetSessionTerms(): void
61 {
62 $manager = $this->getManagerMock();
63 $terms = [321, 654, 987];
64
65 $manager->setSessionTerms(77, $terms);
66
67 $this->assertSame($terms, $manager->getSessionTerms(77));
68 }
69}
__construct()
Constructor setup ILIAS global object @access public.
Definition: class.ilias.php:76