miniMVC/tests/miniMVCTest.php

51 lines
955 B
PHP
Raw Normal View History

2012-01-13 12:28:11 -05:00
<?php
2012-01-17 08:10:30 -05:00
/**
* Test class for miniMVC class
*/
2012-01-16 21:36:28 -05:00
class miniMVCTest extends UnitTestCase {
function __construct()
{
parent::__construct('miniMVC Class Tests');
}
function setUp()
{
2012-05-18 16:20:47 -04:00
$this->mm = miniMVC::get_instance();
2012-01-16 21:36:28 -05:00
}
function tearDown()
{
unset($this->mm);
}
function testNoClone()
2012-01-16 21:36:28 -05:00
{
// 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::get_instance());
2012-01-16 21:36:28 -05:00
2012-05-18 16:20:47 -04:00
// miniMVC extends MM, right?
2012-04-27 16:28:25 -04:00
$this->assertIsA($this->mm, 'MM');
}
function testInvoke()
{
2012-01-17 08:10:30 -05:00
// Invoke function should return the same reference than miniMVC::get_instance() does
$mm = $this->mm;
$this->assertIdentical($mm(), miniMVC::get_instance());
$this->assertIdentical($this->mm->__invoke(), miniMVC::get_instance());
2012-01-16 21:36:28 -05:00
}
2012-01-13 12:28:11 -05:00
}
2012-01-17 08:10:30 -05:00