/** * Test extensions */ public function testExtensions() { $loader = new \Phalcon\Loader(); $this->assertException(array($loader, 'setExtensions'), array('php'), 'Phalcon\\Loader\\Exception'); $this->assertEquals($loader->getExtensions(), array('php')); $loader->setExtensions(array('php', 'inc')); $this->assertEquals($loader->getExtensions(), array('php', 'inc')); }
public function testDirectoriesExtensions() { $loader = new Phalcon\Loader(); $loader->setExtensions(array('inc', 'php')); $loader->registerDirs(array("unit-tests/vendor/example/dialects/", "unit-tests/vendor/example/types/", "unit-tests/vendor/")); $loader->register(); $leSome = new \example\adapter\LeAnotherSome(); $this->assertEquals(get_class($leSome), 'Example\\Adapter\\LeAnotherSome'); $loader->unregister(); }
<?php // Creates the autoloader $loader = new \Phalcon\Loader(); //Set file extensions to check $loader->setExtensions(array("php", "inc", "phb"));