xref: /plugin/farmer/_test/core.test.php (revision bfecda9bdfc893a711f25b8c718ff465e70d4212)
185becf1bSAndreas Gohr<?php
285becf1bSAndreas Gohrnamespace plugin\struct\test;
385becf1bSAndreas Gohr
485becf1bSAndreas Gohrrequire_once(__DIR__ . '/../DokuWikiFarmCore.php');
585becf1bSAndreas Gohr
685becf1bSAndreas Gohrclass DokuWikiFarmCore extends \DokuWikiFarmCore {
785becf1bSAndreas Gohr    public function getAnimalNamesForHost($host) {
885becf1bSAndreas Gohr        return parent::getAnimalNamesForHost($host);
985becf1bSAndreas Gohr    }
1085becf1bSAndreas Gohr}
1185becf1bSAndreas Gohr
1285becf1bSAndreas Gohr
1385becf1bSAndreas Gohr/**
1485becf1bSAndreas Gohr * @group plugin_farmer
1585becf1bSAndreas Gohr * @group plugins
1685becf1bSAndreas Gohr */
1785becf1bSAndreas Gohrclass core_plugin_farmer_test extends \DokuWikiTest {
1885becf1bSAndreas Gohr
1985becf1bSAndreas Gohr    protected $pluginsEnabled = array('farmer');
2085becf1bSAndreas Gohr
2185becf1bSAndreas Gohr
2285becf1bSAndreas Gohr    public function test_hostsAnimals() {
2385becf1bSAndreas Gohr        $core = new DokuWikiFarmCore();
2485becf1bSAndreas Gohr
2585becf1bSAndreas Gohr        $input = 'www.foobar.example.com:8000';
2685becf1bSAndreas Gohr        $expect = array(
2785becf1bSAndreas Gohr            'www.foobar.example.com.8000',
2885becf1bSAndreas Gohr            'foobar.example.com.8000',
2985becf1bSAndreas Gohr            'www.foobar.example.com',
3085becf1bSAndreas Gohr            'foobar.example.com',
31*bfecda9bSAndreas Gohr            'www.foobar.example',
3285becf1bSAndreas Gohr            'foobar.example',
3385becf1bSAndreas Gohr            'www.foobar',
3485becf1bSAndreas Gohr            'foobar',
3585becf1bSAndreas Gohr            'www',
3685becf1bSAndreas Gohr        );
3785becf1bSAndreas Gohr
3885becf1bSAndreas Gohr        $this->assertEquals($expect, $core->getAnimalNamesForHost($input));
3985becf1bSAndreas Gohr    }
4085becf1bSAndreas Gohr}
41