<?php
// NIKAcore: core classes for PHP websites
//
// Copyright (C) 2003 NIKA Consulting, Inc.
//
// This file is part of NIKAcore.
//
// NIKAcore is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License as published by the Free
// Software Foundation; either version 2.1 of the License, or (at your option)
// any later version.
//
// NIKAcore is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
// more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with NIKAcore; if not, write to the Free Software Foundation, Inc., 59
// Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// Contact hide@address.com with comments, questions, or patches.
require_once('test-setup.php');
require_once('Habitat.php');
class Tst_Habitat extends TestCase {
function setUp() { $this->h = new Habitat; }
function test_getDocumentRoot() {
$this->assertEquals($_SERVER['DOCUMENT_ROOT'], $this->h->getDocumentRoot());
}
function test_getRequestUri() {
$this->assertEquals($_SERVER['REQUEST_URI'], $this->h->getRequestUri());
}
function test_getUrlmapFilename() {
$this->assertEquals('site.urlmap', $this->h->getUrlmapFilename());
}
}
$nikacore_suite->addTest(new TestSuite('Tst_Habitat'));
class MockHabitat extends Habitat {
function setServerVar($key, $value) { $this->server_vars[$key] = $value; }
function setRequestUri($uri) { $this->setServerVar('REQUEST_URI', $uri); }
function setUrlmapFilename($filename) { $this->urlmapFilename = $filename; }
}
class Tst_MockHabitat extends TestCase {
function test_setRequestUri() {
$h = new MockHabitat;
$h->setRequestUri('/asdf');
$this->assertEquals('/asdf', $h->getRequestUri());
}
function test_setUrlmapFilename() {
$h = new MockHabitat;
$h->setUrlmapFilename('test-1.urlmap');
$this->assertEquals('test-1.urlmap', $h->getUrlmapFilename());
}
}
$nikacore_suite->addTest(new TestSuite('Tst_MockHabitat'));
?>