ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\Glossary\Flashcard\FlashcardShuffleManagerTest Class Reference
+ Inheritance diagram for ILIAS\Glossary\Flashcard\FlashcardShuffleManagerTest:
+ Collaboration diagram for ILIAS\Glossary\Flashcard\FlashcardShuffleManagerTest:

Public Member Functions

 testShuffleEntries ()
 
 testShuffleEntriesWithEqualDay ()
 

Static Public Member Functions

static setUpBeforeClass ()
 

Protected Member Functions

 getShuffleManagerMock ()
 

Static Protected Member Functions

static initializeBoxEntries ()
 
static initializeBoxEntriesShuffled ()
 
static initializeBoxEntriesShuffledEqualDay ()
 

Static Protected Attributes

static array $box_entries = []
 
static array $box_entries_shuffled = []
 
static array $box_entries_shuffled_equal_day = []
 

Detailed Description

Definition at line 25 of file FlashcardShuffleManagerTest.php.

Member Function Documentation

◆ getShuffleManagerMock()

ILIAS\Glossary\Flashcard\FlashcardShuffleManagerTest::getShuffleManagerMock ( )
protected

Definition at line 104 of file FlashcardShuffleManagerTest.php.

104 : FlashcardShuffleManager
105 {
106 return new class () extends FlashcardShuffleManager {
107 public function __construct()
108 {
109 }
110
111 protected function shuffle(array $entries): array
112 {
113 usort($entries, fn($a, $b) => strcmp($b->getLastAccess(), $a->getLastAccess()));
114
115 return $entries;
116 }
117 };
118 }
__construct()
Constructor setup ILIAS global object @access public.
Definition: class.ilias.php:76
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples

References Vendor\Package\$a, Vendor\Package\$b, and ILIAS\__construct().

Referenced by ILIAS\Glossary\Flashcard\FlashcardShuffleManagerTest\testShuffleEntries(), and ILIAS\Glossary\Flashcard\FlashcardShuffleManagerTest\testShuffleEntriesWithEqualDay().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initializeBoxEntries()

static ILIAS\Glossary\Flashcard\FlashcardShuffleManagerTest::initializeBoxEntries ( )
staticprotected

Definition at line 44 of file FlashcardShuffleManagerTest.php.

44 : void
45 {
46 self::$box_entries = [
47 new Term(1, 11, 111, 1, "2024-01-01 01:00:00"),
48 new Term(2, 11, 111, 1, "2024-01-02 01:00:00"),
49 new Term(3, 11, 111, 1, "2024-01-02 02:00:00"),
50 new Term(4, 11, 111, 1, "2024-01-02 03:00:00"),
51 new Term(5, 11, 111, 1, "2024-01-02 04:00:00"),
52 new Term(6, 11, 111, 1, "2024-01-03 01:00:00"),
53 new Term(7, 11, 111, 1, "2024-01-04 02:00:00"),
54 new Term(8, 11, 111, 1, "2024-01-05 01:00:00"),
55 new Term(9, 11, 111, 1, "2024-02-01 01:00:00"),
56 new Term(10, 11, 111, 1, "2024-02-02 01:00:00"),
57 new Term(11, 11, 111, 1, "2024-02-03 01:00:00"),
58 new Term(12, 11, 111, 1, "2024-02-03 01:01:00"),
59 new Term(13, 11, 111, 1, "2024-02-03 02:00:00"),
60 new Term(14, 11, 111, 1, "2024-03-01 01:00:00")
61 ];
62 }

Referenced by ILIAS\Glossary\Flashcard\FlashcardShuffleManagerTest\setUpBeforeClass().

+ Here is the caller graph for this function:

◆ initializeBoxEntriesShuffled()

static ILIAS\Glossary\Flashcard\FlashcardShuffleManagerTest::initializeBoxEntriesShuffled ( )
staticprotected

Definition at line 64 of file FlashcardShuffleManagerTest.php.

64 : void
65 {
66 self::$box_entries_shuffled = [
67 new Term(14, 11, 111, 1, "2024-03-01 01:00:00"),
68 new Term(13, 11, 111, 1, "2024-02-03 02:00:00"),
69 new Term(12, 11, 111, 1, "2024-02-03 01:01:00"),
70 new Term(11, 11, 111, 1, "2024-02-03 01:00:00"),
71 new Term(10, 11, 111, 1, "2024-02-02 01:00:00"),
72 new Term(9, 11, 111, 1, "2024-02-01 01:00:00"),
73 new Term(8, 11, 111, 1, "2024-01-05 01:00:00"),
74 new Term(7, 11, 111, 1, "2024-01-04 02:00:00"),
75 new Term(6, 11, 111, 1, "2024-01-03 01:00:00"),
76 new Term(5, 11, 111, 1, "2024-01-02 04:00:00"),
77 new Term(4, 11, 111, 1, "2024-01-02 03:00:00"),
78 new Term(3, 11, 111, 1, "2024-01-02 02:00:00"),
79 new Term(2, 11, 111, 1, "2024-01-02 01:00:00"),
80 new Term(1, 11, 111, 1, "2024-01-01 01:00:00"),
81 ];
82 }

Referenced by ILIAS\Glossary\Flashcard\FlashcardShuffleManagerTest\setUpBeforeClass().

+ Here is the caller graph for this function:

◆ initializeBoxEntriesShuffledEqualDay()

static ILIAS\Glossary\Flashcard\FlashcardShuffleManagerTest::initializeBoxEntriesShuffledEqualDay ( )
staticprotected

Definition at line 84 of file FlashcardShuffleManagerTest.php.

84 : void
85 {
86 self::$box_entries_shuffled_equal_day = [
87 new Term(1, 11, 111, 1, "2024-01-01 01:00:00"),
88 new Term(5, 11, 111, 1, "2024-01-02 04:00:00"),
89 new Term(4, 11, 111, 1, "2024-01-02 03:00:00"),
90 new Term(3, 11, 111, 1, "2024-01-02 02:00:00"),
91 new Term(2, 11, 111, 1, "2024-01-02 01:00:00"),
92 new Term(6, 11, 111, 1, "2024-01-03 01:00:00"),
93 new Term(7, 11, 111, 1, "2024-01-04 02:00:00"),
94 new Term(8, 11, 111, 1, "2024-01-05 01:00:00"),
95 new Term(9, 11, 111, 1, "2024-02-01 01:00:00"),
96 new Term(10, 11, 111, 1, "2024-02-02 01:00:00"),
97 new Term(13, 11, 111, 1, "2024-02-03 02:00:00"),
98 new Term(12, 11, 111, 1, "2024-02-03 01:01:00"),
99 new Term(11, 11, 111, 1, "2024-02-03 01:00:00"),
100 new Term(14, 11, 111, 1, "2024-03-01 01:00:00")
101 ];
102 }

Referenced by ILIAS\Glossary\Flashcard\FlashcardShuffleManagerTest\setUpBeforeClass().

+ Here is the caller graph for this function:

◆ setUpBeforeClass()

static ILIAS\Glossary\Flashcard\FlashcardShuffleManagerTest::setUpBeforeClass ( )
static

◆ testShuffleEntries()

ILIAS\Glossary\Flashcard\FlashcardShuffleManagerTest::testShuffleEntries ( )

Definition at line 120 of file FlashcardShuffleManagerTest.php.

120 : void
121 {
122 $manager = $this->getShuffleManagerMock();
123
124 $entries = $manager->shuffleEntries(self::$box_entries);
125
126 $this->assertEquals(self::$box_entries_shuffled, $entries);
127 }

References ILIAS\Glossary\Flashcard\FlashcardShuffleManagerTest\getShuffleManagerMock().

+ Here is the call graph for this function:

◆ testShuffleEntriesWithEqualDay()

ILIAS\Glossary\Flashcard\FlashcardShuffleManagerTest::testShuffleEntriesWithEqualDay ( )

Definition at line 129 of file FlashcardShuffleManagerTest.php.

129 : void
130 {
131 $manager = $this->getShuffleManagerMock();
132
133 $entries = $manager->shuffleEntriesWithEqualDay(self::$box_entries);
134
135 $this->assertEquals(self::$box_entries_shuffled_equal_day, $entries);
136 }

References ILIAS\Glossary\Flashcard\FlashcardShuffleManagerTest\getShuffleManagerMock().

+ Here is the call graph for this function:

Field Documentation

◆ $box_entries

array ILIAS\Glossary\Flashcard\FlashcardShuffleManagerTest::$box_entries = []
staticprotected

Definition at line 27 of file FlashcardShuffleManagerTest.php.

◆ $box_entries_shuffled

array ILIAS\Glossary\Flashcard\FlashcardShuffleManagerTest::$box_entries_shuffled = []
staticprotected

Definition at line 28 of file FlashcardShuffleManagerTest.php.

◆ $box_entries_shuffled_equal_day

array ILIAS\Glossary\Flashcard\FlashcardShuffleManagerTest::$box_entries_shuffled_equal_day = []
staticprotected

Definition at line 29 of file FlashcardShuffleManagerTest.php.


The documentation for this class was generated from the following file: