48 : void
49 {
50 $content = $this->mockTree(DocumentContent::class, ['title' => 'foo']);
51 $component = $this->mock(Component::class);
52 $signal = $this->mock(Signal::class);
53 $modal_component = $this->mockTree(Lightbox::class, ['getShowSignal' => $signal]);
54 $button_component = $this->mock(Shy::class);
55 $button_component->expects(self::once())->method('withOnClick')->with($signal)->willReturn($button_component);
56
57 $text_page = $this->mock(LightboxTextPage::class);
58
59 $modal = $this->mock(ModalFactory::class);
60 $modal->expects(self::once())->method('lightboxTextPage')->with('rendered', 'foo')->willReturn($text_page);
61 $modal->expects(self::once())->method('lightbox')->with([$text_page])->willReturn($modal_component);
62
63 $instance = new DocumentModal($this->mockTree(UIServices::class, [
64 'renderer' => $this->mockMethod(Renderer::class, 'render', [$component], 'rendered'),
65 'factory' => [
66 'modal' => $modal,
67 'button' => $this->mockMethod(ButtonFactory::class, 'shy', ['foo', ''], $button_component),
68 ],
69 ]),
function (DocumentContent
$c) use ($content, $component):
Component {
70 $this->assertSame($content,
$c);
71 return $component;
72 });
73
74 $this->assertSame([$button_component, $modal_component], $instance->create($content));
75 }