lithium\tests\cases\core\LibrariesTest::testServiceLocation PHP Method

testServiceLocation() public method

Tests locating service objects. These tests may fail if not run on a stock install, as other objects may preceed the core objects in load order.
public testServiceLocation ( )
    public function testServiceLocation()
    {
        $this->assertNull(Libraries::locate('adapter', 'File'));
        $this->assertNull(Libraries::locate('adapter.view', 'File'));
        $this->assertNull(Libraries::locate('invalid_package', 'InvalidClass'));
        $result = Libraries::locate('adapter.template.view', 'File');
        $this->assertEqual('lithium\\template\\view\\adapter\\File', $result);
        $result = Libraries::locate('adapter.storage.cache', 'File');
        $expected = 'lithium\\storage\\cache\\adapter\\File';
        $this->assertEqual($expected, $result);
        $result = Libraries::locate('data.source', 'Database');
        $expected = 'lithium\\data\\source\\Database';
        $this->assertEqual($expected, $result);
        $result = Libraries::locate('adapter.data.source.database', 'MySql');
        $expected = 'lithium\\data\\source\\database\\adapter\\MySql';
        $this->assertEqual($expected, $result);
        $result = Libraries::locate(null, '\\lithium\\data\\source\\Database');
        $expected = '\\lithium\\data\\source\\Database';
        $this->assertEqual($expected, $result);
        $expected = new stdClass();
        $result = Libraries::locate(null, $expected);
        $this->assertEqual($expected, $result);
    }