xref: /plugin/farmer/_test/core.test.php (revision 85becf1b7890015fe3aa8651c1a80fd9664e9915)
1*85becf1bSAndreas Gohr<?php
2*85becf1bSAndreas Gohrnamespace plugin\struct\test;
3*85becf1bSAndreas Gohr
4*85becf1bSAndreas Gohrrequire_once(__DIR__ . '/../DokuWikiFarmCore.php');
5*85becf1bSAndreas Gohr
6*85becf1bSAndreas Gohrclass DokuWikiFarmCore extends \DokuWikiFarmCore {
7*85becf1bSAndreas Gohr    public function getAnimalNamesForHost($host) {
8*85becf1bSAndreas Gohr        return parent::getAnimalNamesForHost($host);
9*85becf1bSAndreas Gohr    }
10*85becf1bSAndreas Gohr}
11*85becf1bSAndreas Gohr
12*85becf1bSAndreas Gohr
13*85becf1bSAndreas Gohr/**
14*85becf1bSAndreas Gohr * @group plugin_farmer
15*85becf1bSAndreas Gohr * @group plugins
16*85becf1bSAndreas Gohr */
17*85becf1bSAndreas Gohrclass core_plugin_farmer_test extends \DokuWikiTest {
18*85becf1bSAndreas Gohr
19*85becf1bSAndreas Gohr    protected $pluginsEnabled = array('farmer');
20*85becf1bSAndreas Gohr
21*85becf1bSAndreas Gohr
22*85becf1bSAndreas Gohr    public function test_hostsAnimals() {
23*85becf1bSAndreas Gohr        $core = new DokuWikiFarmCore();
24*85becf1bSAndreas Gohr
25*85becf1bSAndreas Gohr        $input = 'www.foobar.example.com:8000';
26*85becf1bSAndreas Gohr        $expect = array(
27*85becf1bSAndreas Gohr            'www.foobar.example.com.8000',
28*85becf1bSAndreas Gohr            'foobar.example.com.8000',
29*85becf1bSAndreas Gohr            'www.foobar.example.com',
30*85becf1bSAndreas Gohr            'www.foobar.example',
31*85becf1bSAndreas Gohr            'foobar.example.com',
32*85becf1bSAndreas Gohr            'foobar.example',
33*85becf1bSAndreas Gohr            'www.foobar',
34*85becf1bSAndreas Gohr            'foobar',
35*85becf1bSAndreas Gohr            'www',
36*85becf1bSAndreas Gohr        );
37*85becf1bSAndreas Gohr
38*85becf1bSAndreas Gohr        $this->assertEquals($expect, $core->getAnimalNamesForHost($input));
39*85becf1bSAndreas Gohr    }
40*85becf1bSAndreas Gohr}
41