コード例 #1
0
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
require_once __DIR__ . '/../../bootstrap/unit.php';
$t = new lime_test(20);
class ProjectLoader extends sfServiceContainerLoaderArray
{
    public function validate($content)
    {
        return parent::validate($content);
    }
}
$loader = new ProjectLoader(null);
// ->validate()
try {
    $loader->validate(sfYaml::load(__DIR__ . '/fixtures/yaml/nonvalid1.yml'));
    $t->fail('->validate() throws an InvalidArgumentException if the loaded definition is not an array');
} catch (InvalidArgumentException $e) {
    $t->pass('->validate() throws an InvalidArgumentException if the loaded definition is not an array');
}
try {
    $loader->validate(sfYaml::load(__DIR__ . '/fixtures/yaml/nonvalid2.yml'));
    $t->fail('->validate() throws an InvalidArgumentException if the loaded definition is not a valid array');
} catch (InvalidArgumentException $e) {
    $t->pass('->validate() throws an InvalidArgumentException if the loaded definition is not a valid array');
}
// ->load() # parameters
$t->diag('->load() # parameters');
list($services, $parameters) = $loader->doLoad(array());
$t->is($parameters, array(), '->load() return emty parameters array for an empty array definition');
list($services, $parameters) = $loader->doLoad(sfYaml::load(__DIR__ . '/fixtures/yaml/services2.yml'));
コード例 #2
0
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
require_once dirname(__FILE__) . '/../../bootstrap/unit.php';
$t = new lime_test(20);
class ProjectLoader extends sfServiceContainerLoaderArray
{
    public function validate($content)
    {
        return parent::validate($content);
    }
}
$loader = new ProjectLoader(null);
// ->validate()
try {
    $loader->validate(sfYaml::load(dirname(__FILE__) . '/fixtures/yaml/nonvalid1.yml'));
    $t->fail('->validate() throws an InvalidArgumentException if the loaded definition is not an array');
} catch (InvalidArgumentException $e) {
    $t->pass('->validate() throws an InvalidArgumentException if the loaded definition is not an array');
}
try {
    $loader->validate(sfYaml::load(dirname(__FILE__) . '/fixtures/yaml/nonvalid2.yml'));
    $t->fail('->validate() throws an InvalidArgumentException if the loaded definition is not a valid array');
} catch (InvalidArgumentException $e) {
    $t->pass('->validate() throws an InvalidArgumentException if the loaded definition is not a valid array');
}
// ->load() # parameters
$t->diag('->load() # parameters');
list($services, $parameters) = $loader->doLoad(array());
$t->is($parameters, array(), '->load() return emty parameters array for an empty array definition');
list($services, $parameters) = $loader->doLoad(sfYaml::load(dirname(__FILE__) . '/fixtures/yaml/services2.yml'));