Пример #1
0
<?php

__mf_init_tests('Obj');
/**
 * Test class for MF_Obj_MixinsManager.
 * Generated by PHPUnit on 2010-04-01 at 17:04:23.
 */
class MF_Obj_MixinsManagerTest extends PHPUnit_Framework_TestCase
{
    public function setup()
    {
        // reset our singleton ready for the next round of testing
        MF_Obj_MixinsManager::destroy();
    }
    public function testMixinsManagerIsSingleton()
    {
        $caughtException = false;
        try {
            $obj = new MF_Obj_MixinsManager();
        } catch (Exception $e) {
            if ($e instanceof MF_PHP_E_IsSingleton) {
                $caughtException = true;
            }
        }
        $this->assertTrue($caughtException);
    }
    public function testCanResetListOfKnownMixins()
    {
        // entry conditions
        $this->assertEquals(0, MF_Obj_MixinsManager::$mixinAutoInc);
        __mf_extend('Test_ObjExt', 'Test_Obj_ExtMixin');
Пример #2
0
<?php

__mf_init_tests("Exception");
class MF_Exception_EnterpriseTest extends PHPUnit_Framework_TestCase
{
    /**
     *
     * @var MF_Exception_Enterprise
     */
    public $fixture;
    /**
     *
     * @var MF_Exception_Enterprise
     */
    public $fixtureWithRootCause;
    /**
     *
     * @var MF_Exception_Enterprise
     */
    public $fixtureWithSymptom;
    public function setup()
    {
        $this->fixture = new MF_Exception_Enterprise(500, 1, 'param 1: %s, param 2: %s', array('array 1', 'array 2'));
        $this->type = 'MF_Exception_Enterprise';
        $this->file = basename(__FILE__);
        $this->line = __LINE__ - 3;
        $rootCause = new Test_Exception_RootCause();
        $this->fixtureWithRootCause = new MF_Exception_Enterprise(500, 0, 'param 1: %s, param 2: %s', array('array 1', 'array 2'), $rootCause);
        $symptom = new Test_Exception_Symptom();
        $this->fixtureWithSymptom = new MF_Exception_Enterprise(500, 0, 'param 1: %s, param 2: %s', array('array 1', 'array 2'), $symptom);
    }