9 namespace Fossology\Lib\View;
16 const START_OFFSET = 5;
23 protected function setUp() :
void
25 $highlightState = M::mock(HighlightState::class);
26 $highlightState->shouldReceive(
"openExistingElements")->withAnyArgs()->andReturn(
"");
27 $highlightState->shouldReceive(
"closeOpenElements")->withAnyArgs()->andReturn(
"");
28 $this->result =
new PagedHexResult(self::START_OFFSET, $highlightState);
31 protected function tearDown() :
void
36 public function testAddSmallAmountOfText()
38 $this->result->appendContentText(
"foo bar");
41 $this->result->getText(),
42 is(
"0x00000005 |66 6f 6f 20 62 61 72 __ __ __ __ __ __ __ __ __| |foo bar |"));
45 public function testAddOneHexLineOfText()
47 $this->result->appendContentText(
"foo bar baz done");
50 $this->result->getText(),
51 is(
"0x00000005 |66 6f 6f 20 62 61 72 20 62 61 7a 20 64 6f 6e 65| |foo bar baz done|<br/>\n"));
54 public function testAddMoreThanOneHexLineOfText()
56 $this->result->appendContentText(
"foo bar baz donefoo bar");
59 $this->result->getText(),
60 is(
"0x00000005 |66 6f 6f 20 62 61 72 20 62 61 7a 20 64 6f 6e 65| |foo bar baz done|<br/>\n" .
61 "0x00000015 |66 6f 6f 20 62 61 72 __ __ __ __ __ __ __ __ __| |foo bar |"));
64 public function testAddMetaText()
66 $this->result->appendContentText(
"foo ");
67 $this->result->appendMetaText(
"<b>");
68 $this->result->appendContentText(
"bar");
69 $this->result->appendMetaText(
"</b>");
70 $this->result->appendContentText(
"baz done");
73 $this->result->getText(),
74 is(
"0x00000005 |66 6f 6f 20 <b>62 61 72 </b>62 61 7a 20 64 6f 6e 65 __| |foo <b>bar</b>baz done |"));