1<?php 2 3namespace plugin\farmer\test; 4 5require_once(__DIR__ . '/../DokuWikiFarmCore.php'); 6 7class DokuWikiFarmCore extends \DokuWikiFarmCore 8{ 9 /** @noinspection PhpMissingParentConstructorInspection */ 10 public function __construct() 11 { 12 $this->loadConfig(); 13 // we do not intitialize anyting else here because it's already too late and DOKU_INC is already set 14 } 15 16 17 public function getAnimalNamesForHost($host) 18 { 19 return parent::getAnimalNamesForHost($host); 20 } 21} 22 23 24/** 25 * @group plugin_farmer 26 * @group plugins 27 */ 28class core_plugin_farmer_test extends \DokuWikiTest 29{ 30 31 protected $pluginsEnabled = ['farmer']; 32 33 34 public function test_hostsAnimals() 35 { 36 $core = new DokuWikiFarmCore(); 37 38 $input = 'www.foobar.example.com:8000'; 39 $expect = [ 40 'www.foobar.example.com.8000', 41 'foobar.example.com.8000', 42 'www.foobar.example.com', 43 'foobar.example.com', 44 'www.foobar.example', 45 'foobar.example', 46 'www.foobar', 47 'foobar', 48 'www', 49 ]; 50 51 $this->assertEquals($expect, $core->getAnimalNamesForHost($input)); 52 } 53} 54