* * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /** * Syntax tests for the openlayersmap plugin. * * @group plugin_openlayersmap * @group plugins */ class syntax_plugin_openlayersmap_test extends DokuWikiTest { protected $pluginsEnabled = array('openlayersmap', 'geophp'); /** * copy data and add pages to the index. */ public static function setUpBeforeClass(): void { parent::setUpBeforeClass(); global $conf; $conf['allowdebug'] = 1; $conf['dontlog'] = ''; $conf['cachetime'] = -1; $conf['plugin']['openlayersmap']['displayformat'] = 'DD'; $conf['plugin']['openlayersmap']['optionStaticMapGenerator'] = 'local'; $conf['plugin']['openlayersmap']['autoZoomMap'] = 1; TestUtils::rcopy(TMP_DIR, __DIR__ . '/data/'); } final public function setUp(): void { parent::setUp(); global $conf; // $data = array(); // search($data, $conf['datadir'], 'search_allpages', array('skipacl' => true)); // foreach($data as $val) { // idx_addPage($val['id']); // } if($conf['allowdebug']) { if(mkdir(DOKU_TMP_DATA . 'data/log/debug/', 0777, true)) { touch(DOKU_TMP_DATA . 'data/log/debug/' . date('Y-m-d') . '.log'); } } } final public function tearDown(): void { parent::tearDown(); global $conf; // try to get the debug log after running the test, print and clear if($conf['allowdebug']) { print "\n"; readfile(DOKU_TMP_DATA . 'data/log/debug/' . date('Y-m-d') . '.log'); unlink(DOKU_TMP_DATA . 'data/log/debug/' . date('Y-m-d') . '.log'); } } final public function test_rur(): void { $request = new TestRequest(); $response = $request->get(array('id' => 'rur')); self::assertNotNull($response); $_content = $response->getContent(); self::assertStringContainsString('Rur', $_content); self::assertStringContainsString('', $_content); self::assertStringContainsString('
', $_content); self::assertStringContainsString('', $_content); // Rur parkings $_staticImage = $response->queryHTML('img[src*="olmapmaps:openstreetmap:13:cache_8b:9b:94cd3dabd2d1c470a2d5b4bea6df.png"]'); self::assertNotEmpty($_staticImage); self::assertEquals('medialeft', $_staticImage->attr('class')); self::assertEquals('650', $_staticImage->attr('width')); self::assertEquals('550', $_staticImage->attr('height')); self::assertStringContainsString('Rur parkings', $_staticImage->attr('title')); //
\n //
\n // \n // \n // \n // \n // \n // \n // \n // \n // \n // \n // \n // \n // \n // \n // \n // \n // \n // \n // \n // \n // \n // \n // \n // \n //
Points of Interest
idsymbollatitudelongitudedescription
Rur parkings
1parking50.548611º6.228889º

Parking Dreistegen

2parking50.56384º6.29766º

Parking Grünenthalstrasse

\n //
\n $_latCells = $response->queryHTML('td[class="lat"]'); self::assertNotEmpty($_latCells); // not available in "stable" // self::assertEquals('50.548611º', $_latCells->first()->text()); self::assertEquals('50.548611º', $_latCells->get(0)->textContent); $_lonCells = $response->queryHTML('td[class="lon"]'); self::assertNotEmpty($_lonCells); // not available in "stable" // self::assertEquals('6.29766º', $_lonCells->last()->text()); self::assertEquals('6.29766º', $_lonCells->get(1)->textContent); } final public function test_issue34(): void { $request = new TestRequest(); $response = $request->get(array('id' => 'issue34')); self::assertNotNull($response); } final public function test_issue34_fixed(): void { $request = new TestRequest(); $response = $request->get(array('id' => 'issue34-fixed')); self::assertNotNull($response); $_content = $response->getContent(); self::assertStringContainsString('issue34-fixed', $_content); self::assertStringContainsString('
', $_content); self::assertStringContainsString('', $_content); $_staticImage = $response->queryHTML('img[src*="olmapmaps:openstreetmap:14:cache_32:12:6533646ecb8cf2f193db46305e5f.png"]'); self::assertNotEmpty($_staticImage); self::assertEquals('550', $_staticImage->attr('width')); self::assertEquals('450', $_staticImage->attr('height')); self::assertEmpty(trim($_staticImage->attr('title'))); } }