miniMVC/tests/miniMVCTest.php

51 lines
995 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-22 11:11:36 -04:00
$this->mm = miniMVC\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
2012-05-22 11:11:36 -04:00
$this->assertReference($this->mm, miniMVC\miniMVC::get_instance());
2012-01-16 21:36:28 -05:00
2012-05-18 16:20:47 -04:00
// miniMVC extends MM, right?
2012-05-22 11:11:36 -04:00
$this->assertIsA($this->mm, 'miniMVC\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;
2012-05-22 11:11:36 -04:00
$this->assertIdentical($mm(), miniMVC\miniMVC::get_instance());
$this->assertIdentical($this->mm->__invoke(), miniMVC\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