function testAddReferenceTexts() { $highlight1 = new Highlight(5, 8, 'type1', 2, 6, $this->license1->getId()); $highlights = array($highlight1); $this->highlight->addReferenceTexts($highlights); assertThat($highlight1->getInfoText(), is("10")); }
/** * @param License $license * @param Highlight $highlight * @return string */ protected function getReferenceText(License $license, Highlight $highlight) { $referenceText = substr($license->getText(), $highlight->getRefStart(), min($highlight->getRefLength(), self::REF_TEXT_MAX_LENGTH)); return $referenceText . ($highlight->getRefLength() > self::REF_TEXT_MAX_LENGTH ? " ... " : ""); }