/**
  * Tests whether link_to_timeline() returns the correct link for a timeline.
  *
  * @uses link_to_timeline()
  */
 public function testLinkToTimeline()
 {
     $timeline = $this->_createTimeline();
     $this->dispatch('neatline-time/timelines/show/1');
     $matcher = array('tag' => 'a', 'content' => $timeline->title, 'attributes' => array('href' => record_url($timeline)));
     $linkDefault = link_to_timeline();
     $this->assertTag($matcher, $linkDefault);
     $linkText = 'New Text';
     $linkWithNewText = link_to_timeline($linkText);
     $matcher['content'] = $linkText;
     $this->assertTag($matcher, $linkWithNewText);
     $linkToEditWithProps = link_to_timeline(null, array('class' => 'edit'), 'edit');
     $matcher['content'] = $timeline->title;
     $matcher['attributes']['class'] = 'edit';
     $matcher['attributes']['href'] = record_url($timeline, 'edit');
     $this->assertTag($matcher, $linkToEditWithProps);
 }
/**
 * Displays random featured timelines
 *
 * @param int Maximum number of random featured timelines to display.
 * @return string HTML
 */
function neatlinetime_display_random_featured_timelines($num = 1)
{
    $html = '';
    $timelines = get_db()->getTable('NeatlineTimeTimeline')->findBy(array('random' => 1, 'featured' => 1), $num);
    if ($timelines) {
        foreach ($timelines as $timeline) {
            $html .= '<h3>' . link_to_timeline(null, array(), 'show', $timeline) . '</h3>' . '<div class="description timeline-description">' . timeline('description', array('snippet' => 150), $timeline) . '</div>';
        }
        return $html;
    }
}