ILIAS  trunk Revision v11.0_alpha-1689-g66c127b4ae8
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ClipboardSessionRepositoryTest.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
29 {
30  protected \ILIAS\Repository\Clipboard\ClipboardSessionRepository $clipboard;
31 
32  protected function setUp(): void
33  {
34  parent::setUp();
35  $this->clipboard = new \ILIAS\Repository\Clipboard\ClipboardSessionRepository();
36  $this->clipboard->clear();
37  }
38 
39  protected function tearDown(): void
40  {
41  }
42 
46  public function testClear(): void
47  {
48  $clipboard = $this->clipboard;
49  $clipboard->setCmd("test");
50  $clipboard->setRefIds([4]);
51  $clipboard->setParent(5);
52  $clipboard->clear();
53  $this->assertEquals(
54  "",
55  $clipboard->getCmd()
56  );
57  $this->assertEquals(
58  [],
59  $clipboard->getRefIds()
60  );
61  $this->assertEquals(
62  0,
63  $clipboard->getParent()
64  );
65  }
66 
70  public function testCmd(): void
71  {
72  $clipboard = $this->clipboard;
73  $clipboard->setCmd("test");
74  $this->assertEquals(
75  "test",
76  $clipboard->getCmd()
77  );
78  }
79 
83  public function testRefIds(): void
84  {
85  $clipboard = $this->clipboard;
86  $clipboard->setRefIds([4]);
87  $this->assertEquals(
88  [4],
89  $clipboard->getRefIds()
90  );
91  }
92 
96  public function testParent(): void
97  {
98  $clipboard = $this->clipboard;
99  $clipboard->setParent(5);
100  $this->assertEquals(
101  5,
102  $clipboard->getParent()
103  );
104  }
105 
109  public function testHasEntriesNoCmd(): void
110  {
111  $clipboard = $this->clipboard;
112  $clipboard->setRefIds([4]);
113  $this->assertEquals(
114  false,
115  $clipboard->hasEntries()
116  );
117  }
118 
122  public function testHasEntriesCmd(): void
123  {
124  $clipboard = $this->clipboard;
125  $clipboard->setRefIds([4]);
126  $clipboard->setCmd("cut");
127  $this->assertEquals(
128  true,
129  $clipboard->hasEntries()
130  );
131  }
132 
136  public function testHasEntriesCmdEmptyRefIds(): void
137  {
138  $clipboard = $this->clipboard;
139  $clipboard->setRefIds([]);
140  $clipboard->setCmd("cut");
141  $this->assertEquals(
142  false,
143  $clipboard->hasEntries()
144  );
145  }
146 }
testHasEntriesCmd()
Test hasEntries returns true if ref ids and cmd is given.
ILIAS Repository Clipboard ClipboardSessionRepository $clipboard
testHasEntriesNoCmd()
Test hasEntries returns false if ref ids, but no cmd is given.
testHasEntriesCmdEmptyRefIds()
Test hasEntries returns false if empty ref ids array and cmd is given.