miniMVC/tests/miniMVCTest.php

51 lines
995 B
PHP

<?php
/**
* Test class for miniMVC class
*/
class miniMVCTest extends UnitTestCase {
function __construct()
{
parent::__construct('miniMVC Class Tests');
}
function setUp()
{
$this->mm = miniMVC\miniMVC::get_instance();
}
function tearDown()
{
unset($this->mm);
}
function testNoClone()
{
// Expect an error trying to clone the miniMVC object
$this->expectError("Clone is not allowed.");
$mm2 = clone $this->mm;
}
function testReferences()
{
// miniMVC::get_instance returns reference to latest miniMVC object
$this->assertReference($this->mm, miniMVC\miniMVC::get_instance());
// miniMVC extends MM, right?
$this->assertIsA($this->mm, 'miniMVC\MM');
}
function testInvoke()
{
// Invoke function should return the same reference than miniMVC::get_instance() does
$mm = $this->mm;
$this->assertIdentical($mm(), miniMVC\miniMVC::get_instance());
$this->assertIdentical($this->mm->__invoke(), miniMVC\miniMVC::get_instance());
}
}