summaryrefslogtreecommitdiff
path: root/tests/unit/PradoBaseTest.php
blob: 0b9cd7d678c4242eaf8aa3ebeeefde807e571039 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php

use Prado\Prado;

/**
 * @package System
 */
class PradoBaseTest extends PHPUnit_Framework_TestCase
{
    const INTERFACE_FQN = 'Prado\\Web\\UI\\IValidatable';
    const INTERFACE_SHORT_NAME = 'IValidatable';
    const CLASS_FQN = 'Prado\\Web\\UI\\WebControls\\TButton';
    const CLASS_PRADO_FULLNAME = 'System.Web.UI.WebControls.TButton';

    public function testUsingNamespace()
    {
        $this->assertFalse(class_exists(self::CLASS_FQN, false));
        Prado::using(self::CLASS_FQN);
        $this->assertTrue(class_exists(self::CLASS_FQN, false));
    }

    public function testUsingInterface()
    {
        $this->assertFalse(interface_exists(self::INTERFACE_SHORT_NAME, false));
        Prado::using(self::INTERFACE_FQN);
        $this->assertTrue(interface_exists(self::INTERFACE_SHORT_NAME, false));
    }

    public function testCreateComponentWithNamespace()
    {
        $this->assertInstanceOf(self::CLASS_FQN, Prado::createComponent(self::CLASS_FQN));
    }

    public function testCreateComponentWithPradoNamespace()
    {
        $this->assertInstanceOf(self::CLASS_FQN, Prado::createComponent(self::CLASS_PRADO_FULLNAME));
    }


}