9 namespace Fossology\Lib\View;
27 const START_OFFSET = 12;
28 const META_TEXT =
"<meta>";
29 const CONTENT_TEXT =
"<content>";
34 protected function setUp() :
void
39 public function testGetStartOffset()
41 assertThat($this->pagedResult->getStartOffset(), is(self::START_OFFSET));
44 public function testIsEmpty()
46 $this->assertTrue($this->pagedResult->isEmpty());
48 $this->pagedResult->appendMetaText(self::META_TEXT);
50 $this->assertTrue($this->pagedResult->isEmpty());
52 $this->pagedResult->appendContentText(self::CONTENT_TEXT);
54 $this->assertFalse($this->pagedResult->isEmpty());
57 public function testAppendMetaText()
59 $this->pagedResult->appendMetaText(self::META_TEXT);
61 assertThat($this->pagedResult->getCurrentOffset(), is(self::START_OFFSET));
62 assertThat($this->pagedResult->getText(), is(self::META_TEXT));
65 public function testAppendContentText()
67 $this->pagedResult->appendContentText(self::CONTENT_TEXT);
69 assertThat($this->pagedResult->getCurrentOffset(), is(self::START_OFFSET + strlen(self::CONTENT_TEXT)));
70 assertThat($this->pagedResult->getText(), is(self::CONTENT_TEXT));
73 public function testAppendContentAndMetaText()
75 $this->pagedResult->appendContentText(self::CONTENT_TEXT);
76 $this->pagedResult->appendMetaText(self::META_TEXT);
78 assertThat($this->pagedResult->getCurrentOffset(), is(self::START_OFFSET + strlen(self::CONTENT_TEXT)));
79 assertThat($this->pagedResult->getText(), is(self::CONTENT_TEXT . self::META_TEXT));
82 public function testAppendMetaAndContentText()
84 $this->pagedResult->appendMetaText(self::META_TEXT);
85 $this->pagedResult->appendContentText(self::CONTENT_TEXT);
87 assertThat($this->pagedResult->getCurrentOffset(), is(self::START_OFFSET + strlen(self::CONTENT_TEXT)));
88 assertThat($this->pagedResult->getText(), is(self::META_TEXT . self::CONTENT_TEXT));