function testCoordsMapLink()
 {
     $this->assertEqual('http://maps.google.com/maps?q=42.7118454,-73.2054918+(point)&z=19&ll=42.7118454,-73.2054918', util_coordsMapLink(-73.2054918, 42.7118454));
     $this->assertEqual('http://maps.google.com/maps?q=42.7118454,-73.2054918+(point)&z=12&ll=42.7118454,-73.2054918', util_coordsMapLink(-73.2054918, 42.7118454, 12));
 }
 public function renderAsViewEmbed()
 {
     $this->cacheImages();
     $rendered = '<div class="specimen embedded">' . "\n" . '  <h3>' . htmlentities($this->name) . '</h3>' . "\n" . '  <ul class="base-info">' . "\n";
     if ($this->gps_longitude && $this->gps_latitude && ($this->gps_longitude != 0 || $this->gps_latitude != 0)) {
         $rendered .= '    <li><span class="field-label">' . util_lang('coordinates') . '</span> : <span class="field-value"><a href="' . util_coordsMapLink($this->gps_longitude, $this->gps_latitude) . '">' . htmlentities($this->gps_longitude) . ',' . htmlentities($this->gps_latitude) . '</a></span></li>' . "\n";
     }
     if ($this->notes) {
         $rendered .= '    <li><span class="field-label">' . util_lang('notes') . '</span> : <span class="field-value">' . htmlentities($this->notes) . '</span></li>' . "\n";
     }
     if ($this->catalog_identifier) {
         $rendered .= '    <li><span class="field-label">' . util_lang('catalog_identifier') . '</span> : <span class="field-value">' . htmlentities($this->catalog_identifier) . '</span></li>' . "\n";
     }
     $rendered .= '  </ul>' . "\n";
     if (count($this->images) > 0) {
         $rendered .= '  <ul class="specimen-images inline">' . "\n";
         foreach ($this->images as $image) {
             $rendered .= '    ' . $image->renderAsListItem() . "\n";
         }
         $rendered .= '  </ul>' . "\n";
     }
     $rendered .= '</div>';
     return $rendered;
 }
    function testRenderAsViewEmbed()
    {
        $s = Specimen::getOneFromDb(['specimen_id' => 8001], $this->DB);
        $s->cacheImages();
        /*
        # Specimen:
        'specimen_id',8001
        'created_at',
        'updated_at',
        'user_id',110
        'link_to_type',authoritative_plant
        'link_to_id',5001
        'name',sci quad authoritative
        'gps_longitude',-73.2054918
        'gps_latitude',42.7118454
        'notes',notes on authoritative specimen
        'ordering',1
        'catalog_identifier',1a
        'flag_workflow_published',1
        'flag_workflow_validated',1
        'flag_delete'0
        
        (8001,NOW(),NOW(), 110, 'authoritative_plant', 5001, 'sci quad authoritative', -73.2054918, 42.7118454, 'notes on authoritative specimen', 1, '1a', 1, 1, 0),
        
        # VALID_LINK_TO_TYPES =  ['authoritative_plant', 'notebook_page'];
        */
        $canonical = '<div class="specimen embedded">
  <h3>' . htmlentities($s->name) . '</h3>
  <ul class="base-info">
    <li><span class="field-label">' . util_lang('coordinates') . '</span> : <span class="field-value"><a href="' . util_coordsMapLink($s->gps_longitude, $s->gps_latitude) . '">' . htmlentities($s->gps_longitude) . ',' . htmlentities($s->gps_latitude) . '</a></span></li>
    <li><span class="field-label">' . util_lang('notes') . '</span> : <span class="field-value">' . htmlentities($s->notes) . '</span></li>
    <li><span class="field-label">' . util_lang('catalog_identifier') . '</span> : <span class="field-value">' . htmlentities($s->catalog_identifier) . '</span></li>
  </ul>
  <ul class="specimen-images inline">
';
        foreach ($s->images as $image) {
            $canonical .= '    ' . $image->renderAsListItem() . "\n";
        }
        $canonical .= '  </ul>
</div>';
        $rendered = $s->renderAsViewEmbed();
        //            echo "<pre>\n".htmlentities($canonical)."\n------------------\n".htmlentities($rendered)."\n</pre>";
        $this->assertEqual($canonical, $rendered);
        $this->assertNoPattern('/IMPLEMENTED/', $rendered);
    }