19 declare(strict_types=1);
31 $writer = $this->getMockBuilder(ilXmlWriter::class)
32 ->disableOriginalConstructor()
33 ->onlyMethods([
'xmlStartTag',
'xmlElement',
'xmlEndTag'])
35 $writer->expects($this->once())
36 ->method(
'xmlStartTag')
50 $writer->expects($this->exactly(3))
51 ->method(
'xmlElement')
52 ->willReturnCallback(fn($tag, $attrs,
$data) => match([$tag, $attrs,
$data]) {
53 [
'Title', [],
'title'] => 1,
54 [
'Description', [],
'description'] => 2,
55 [
'Target', [],
'target'] => 3
57 $writer->expects($this->once())
61 $param1 = $this->getMockBuilder(ilWebLinkParameter::class)
62 ->disableOriginalConstructor()
63 ->onlyMethods([
'toXML'])
65 $param1->expects($this->once())
68 $param2 = $this->getMockBuilder(ilWebLinkParameter::class)
69 ->disableOriginalConstructor()
70 ->onlyMethods([
'toXML'])
72 $param2->expects($this->once())
76 $item_stub = $this->getMockForAbstractClass(
79 1, 13,
'title',
'description',
'target',
84 $item_stub->expects($this->once())
85 ->method(
'isInternal')
87 $item_stub->toXML($writer, 7);
Unit tests for ilWebLinkItem.