<?php

/**
 * Test class for miniMVC class
 */
class miniMVCTest extends UnitTestCase {

	function __construct()
	{
		parent::__construct('miniMVC Class Tests');
	}
	
	function setUp()
	{
		$this->mm = new miniMVC();
	}
	
	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::get_instance());
		
		// miniMVC extends JSObject, right?
		$this->assertIsA($this->mm, 'MM');
	}
	
	function testInvoke()
	{
		// 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());
	}

}