Beispiel #1
0
 public function testGroupRanges()
 {
     $r1 = new Reference();
     $r1->addBookChapterAndVerseRange(1, 2, 6, 7);
     $r1->addBookChapterAndVerseRange(1, 2, 10, 14);
     $r1->addBookChapterAndVerseRange(1, 3, 2, 4);
     $groups = $r1->groupRanges();
     $this->assertEquals(2, count($groups));
     list($group1, $group2) = $groups;
     $this->assertEquals(2, count($group1));
     $this->assertEquals(1, count($group2));
     //  Overlapping chapter...
     $r2 = new Reference();
     $r2->addBookAndChapter(1, 2);
     $r2->addBookChapterAndVerse(1, 3, 1);
     $r2->addBookChapterAndVerseRange(1, 3, 7, 8);
     $groups = $r2->groupRanges();
     $this->assertEquals(2, count($groups));
     list($group1, $group2) = $groups;
     $this->assertEquals(1, count($group1));
     $this->assertEquals(1, count($group2));
     // matt+18;19.1,3,5,7 -> 18:1-19:1; 19:3,5,7
     $r3 = new Reference();
     $r3->addBookAndChapter(1, 18);
     $r3->addBookChapterAndVerse(1, 19, 1);
     $r3->addBookChapterAndVerse(1, 19, 3);
     $r3->addBookChapterAndVerse(1, 19, 5);
     $r3->addBookChapterAndVerse(1, 19, 7);
     $groups = $r3->groupRanges();
     $this->assertEquals(2, count($groups));
     list($group1, $group2) = $groups;
     $this->assertEquals(1, count($group1));
     $this->assertEquals(3, count($group2));
 }