ILIAS  trunk Revision v11.0_alpha-2662-g519ff7d528f
StandardToastTest Class Reference
+ Inheritance diagram for StandardToastTest:
+ Collaboration diagram for StandardToastTest:

Public Member Functions

 testStandardToast ()
 
 testReservedActions (ToastAction $action)
 
- Public Member Functions inherited from BaseToastSetUp
 getDIC ()
 
 getDummyToastProviderWithToasts (array $toasts)
 

Static Public Member Functions

static reservedActionsProvider ()
 

Additional Inherited Members

- Protected Member Functions inherited from BaseToastSetUp
 setUp ()
 
- Protected Attributes inherited from BaseToastSetUp
ToastProvider $provider
 
ToastFactory $factory
 

Detailed Description

Definition at line 28 of file StandardToastTest.php.

Member Function Documentation

◆ reservedActionsProvider()

static StandardToastTest::reservedActionsProvider ( )
static

Definition at line 72 of file StandardToastTest.php.

72  : \Iterator
73  {
74  $action = (fn(): true => true);
75  yield [new ToastAction('shown', 'shown', $action)];
76  yield [new ToastAction('closed', 'closed', $action)];
77  yield [new ToastAction('vanished', 'vanished', $action)];
78  }

◆ testReservedActions()

StandardToastTest::testReservedActions ( ToastAction  $action)

Definition at line 81 of file StandardToastTest.php.

References $id, and factory().

81  : void
82  {
83  $id = $this->createMock(IdentificationInterface::class);
84 
85  $standard_toast = $this->factory->standard(
86  $id,
87  'Toast Title'
88  );
89 
90  $this->expectException(\InvalidArgumentException::class);
91  $standard_toast = $standard_toast->withAdditionToastAction($action);
92  }
factory()
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:

◆ testStandardToast()

StandardToastTest::testStandardToast ( )

Definition at line 30 of file StandardToastTest.php.

References $id, and factory().

30  : void
31  {
32  $id = $this->createMock(IdentificationInterface::class);
33 
34  $standard_toast = $this->factory->standard(
35  $id,
36  'Toast Title'
37  );
38 
39  $this->assertInstanceOf(StandardToastItem::class, $standard_toast);
40  $this->assertSame('Toast Title', $standard_toast->getTitle());
41  $this->assertSame([], $standard_toast->getAllToastActions());
42  $this->assertCount(0, $standard_toast->getAllToastActions());
43  $this->assertCount(0, $standard_toast->getAdditionalToastActions());
44 
45  $handle = (fn(): true => true);
46 
47  $standard_toast = $standard_toast->withShownCallable($handle);
48  $this->assertCount(1, $standard_toast->getAllToastActions());
49  $this->assertCount(0, $standard_toast->getAdditionalToastActions());
50 
51  $standard_toast = $standard_toast->withClosedCallable($handle);
52  $this->assertCount(2, $standard_toast->getAllToastActions());
53  $this->assertCount(0, $standard_toast->getAdditionalToastActions());
54 
55  $standard_toast = $standard_toast->withVanishedCallable($handle);
56  $this->assertCount(3, $standard_toast->getAllToastActions());
57  $this->assertCount(0, $standard_toast->getAdditionalToastActions());
58 
59  $standard_toast = $standard_toast->withAdditionToastAction($this->factory->action('one', 'One', $handle));
60  $this->assertCount(4, $standard_toast->getAllToastActions());
61  $this->assertCount(1, $standard_toast->getAdditionalToastActions());
62 
63  $standard_toast = $standard_toast->withAdditionToastAction($this->factory->action('two', 'Two', $handle));
64  $this->assertCount(5, $standard_toast->getAllToastActions());
65  $this->assertCount(2, $standard_toast->getAdditionalToastActions());
66 
67  // double add
68  $this->expectException(\InvalidArgumentException::class);
69  $standard_toast = $standard_toast->withAdditionToastAction($this->factory->action('two', 'Two', $handle));
70  }
factory()
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:

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