18 declare(strict_types=1);
25 require_once(__DIR__ .
"/BaseToastSetUp.php");
31 $id = $this->createMock(IdentificationInterface::class);
33 $standard_toast = $this->
factory->standard(
38 $this->assertInstanceOf(StandardToastItem::class, $standard_toast);
39 $this->assertEquals(
'Toast Title', $standard_toast->getTitle());
40 $this->assertEquals([], $standard_toast->getAllToastActions());
41 $this->assertCount(0, $standard_toast->getAllToastActions());
42 $this->assertCount(0, $standard_toast->getAdditionalToastActions());
44 $handle = (fn():
true =>
true);
46 $standard_toast = $standard_toast->withShownCallable($handle);
47 $this->assertCount(1, $standard_toast->getAllToastActions());
48 $this->assertCount(0, $standard_toast->getAdditionalToastActions());
50 $standard_toast = $standard_toast->withClosedCallable($handle);
51 $this->assertCount(2, $standard_toast->getAllToastActions());
52 $this->assertCount(0, $standard_toast->getAdditionalToastActions());
54 $standard_toast = $standard_toast->withVanishedCallable($handle);
55 $this->assertCount(3, $standard_toast->getAllToastActions());
56 $this->assertCount(0, $standard_toast->getAdditionalToastActions());
58 $standard_toast = $standard_toast->withAdditionToastAction($this->
factory->action(
'one',
'One', $handle));
59 $this->assertCount(4, $standard_toast->getAllToastActions());
60 $this->assertCount(1, $standard_toast->getAdditionalToastActions());
62 $standard_toast = $standard_toast->withAdditionToastAction($this->
factory->action(
'two',
'Two', $handle));
63 $this->assertCount(5, $standard_toast->getAllToastActions());
64 $this->assertCount(2, $standard_toast->getAdditionalToastActions());
67 $this->expectException(\InvalidArgumentException::class);
68 $standard_toast = $standard_toast->withAdditionToastAction($this->
factory->action(
'two',
'Two', $handle));
73 $action = (fn():
true =>
true);
82 #[DataProvider('reservedActionsProvider')] 85 $id = $this->createMock(IdentificationInterface::class);
87 $standard_toast = $this->
factory->standard(
92 $this->expectException(\InvalidArgumentException::class);
93 $standard_toast = $standard_toast->withAdditionToastAction($action);
testReservedActions(ToastAction $action)
static reservedActionsProvider()
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins