当前位置: 首页>>代码示例>>PHP>>正文


PHP lime_test::is_deeply方法代码示例

本文整理汇总了PHP中lime_test::is_deeply方法的典型用法代码示例。如果您正苦于以下问题:PHP lime_test::is_deeply方法的具体用法?PHP lime_test::is_deeply怎么用?PHP lime_test::is_deeply使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在lime_test的用法示例。


在下文中一共展示了lime_test::is_deeply方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: check_test_tree

function check_test_tree(lime_test $t, ioMenuItem $menu)
{
    $t->info('### Running checks on the integrity of the test tree.');
    $t->is(count($menu), 2, 'count(rt) returns 2 children');
    $t->is(count($menu['Parent 1']), 3, 'count(pt1) returns 3 children');
    $t->is(count($menu['Parent 2']), 1, 'count(pt2) returns 1 child');
    $t->is(count($menu['Parent 2']['Child 4']), 1, 'count(ch4) returns 1 child');
    $t->is_deeply($menu['Parent 2']['Child 4']['Grandchild 1']->getName(), 'Grandchild 1', 'gc1 has the name "Grandchild 1"');
}
开发者ID:vicb,项目名称:ioMenuPlugin,代码行数:9,代码来源:unitHelper.php

示例2: php_html_writer_run_tests

function php_html_writer_run_tests(lime_test $t, array $tests, $callable)
{
    foreach ($tests as $test) {
        $parameters = $test['params'];
        $expectedResult = isset($test['result']) ? $test['result'] : null;
        try {
            $result = call_user_func_array($callable, $parameters);
            if (isset($test['throws'])) {
                $t->fail($parameters[0] . ' throws a ' . $test['throws']);
            } else {
                $t->is_deeply($result, $expectedResult, '"' . str_replace('"', '\'', $parameters[0]) . '" ' . str_replace("\n", '', var_export($expectedResult, true)));
            }
        } catch (Exception $exception) {
            $exceptionClass = get_class($exception);
            $message = sprintf('"%s" throws a %s: %s', isset($parameters[0]) ? str_replace('"', '\'', (string) $parameters[0]) : 'NULL', $exceptionClass, $exception->getMessage());
            if (isset($test['throws']) && $test['throws'] == $exceptionClass) {
                $t->pass($message);
            } else {
                $t->fail($message);
            }
        }
    }
}
开发者ID:runopencode,项目名称:diem-extended,代码行数:23,代码来源:phpHtmlWriterTestHelper.php

示例3: dirname

<?php

$app = 'frontend';
$fixtures = 'fixtures/fixtures.yml';
include dirname(__FILE__) . '/../../bootstrap/functional.php';
$t = new lime_test(4);
// ->getChoices()
$t->diag('->getChoices()');
$validator = new sfWidgetFormDoctrineChoice(array('model' => 'Author'));
$author = Doctrine_Core::getTable('Author')->createQuery()->limit(1)->fetchOne();
$t->is_deeply($validator->getChoices(), array(1 => 'Jonathan H. Wage', 2 => 'Fabien POTENCIER'), '->getChoices() returns choices');
$validator->setOption('order_by', array('name', 'asc'));
$t->cmp_ok($validator->getChoices(), '===', array(2 => 'Fabien POTENCIER', 1 => 'Jonathan H. Wage'), '->getChoices() returns ordered choices');
$validator->setOption('table_method', 'testTableMethod');
$t->is_deeply($validator->getChoices(), array(1 => 'Jonathan H. Wage', 2 => 'Fabien POTENCIER'), '->getChoices() returns choices for given "table_method" option');
$validator = new sfWidgetFormDoctrineChoice(array('model' => 'Author', 'query' => Doctrine_Core::getTable('Author')->createQuery()->limit(1)));
$t->is_deeply($validator->getChoices(), array(1 => 'Jonathan H. Wage'), '->getChoices() returns choices for given "query" option');
开发者ID:Phennim,项目名称:symfony1,代码行数:17,代码来源:sfWidgetFormDoctrineChoiceTest.php

示例4: select

ArticlePeer::doDeleteAll();

$title = sfPropelFinder::from('Article')->select('Title')->findOne();
$t->isa_ok($title, 'NULL', 'findOne() called after select(string) returns null when no record is found');

/*******************************/
/* sfPropelFinder::select('*') */
/*******************************/

$t->diag('sfPropelFinder::select(\'*\')');

$finder = sfPropelFinder::from('Category')->select('*');
$category = $finder->findOne();
$t->is($finder->getLatestQuery(), propel_sql('SELECT [P12category.ID, ]category.ID AS "Category.Id", category.NAME AS "Category.Name" FROM category LIMIT 1'), 'select(\'*\') selects all the columns from the main object');
$t->isa_ok($category, 'array', 'findOne() called after select(\'*\') returns an array');
$t->is_deeply(array_keys($category), array('Category.Id', 'Category.Name'), 'select(\'*\') returns all the columns from the main object, in complete form');

/*************************************************************/
/* sfPropelFinder::select(array, sfModelFinder::ASSOCIATIVE) */
/*************************************************************/

$t->diag('sfPropelFinder::select(array, sfModelFinder::ASSOCIATIVE)');

ArticlePeer::doDeleteAll();
CategoryPeer::doDeleteAll();

$finder = sfPropelFinder::from('Category')->
  select(array('Id','Name'), sfModelFinder::ASSOCIATIVE);
$categories = $finder->find();
$t->is($finder->getLatestQuery(), propel_sql('SELECT [P12category.ID, ]category.ID AS Id, category.NAME AS Name FROM category'), 'find() called after select(array) selects several columns');
$t->isa_ok($categories, 'array', 'find() called after select(array) returns an array');
开发者ID:jonphipps,项目名称:Metadata-Registry,代码行数:31,代码来源:sfPropelFinderSelectTest.php

示例5: FormTest

$v = $f->getValidatorSchema();
$t->ok(isset($v['_token_']), '::setCSRFFieldName() changes the CSRF token field name');
$t->is(sfForm::getCSRFFieldName(), '_token_', '::getCSRFFieldName() returns the CSRF token field name');
// ->isMultipart()
$t->diag('->isMultipart()');
$f = new FormTest();
$t->ok(!$f->isMultipart(), '->isMultipart() returns false if the form does not need a multipart form');
$f->setWidgetSchema(new sfWidgetFormSchema(array('image' => new sfWidgetFormInputFile())));
$t->ok($f->isMultipart(), '->isMultipart() returns true if the form needs a multipart form');
// ->setValidators() ->setValidatorSchema() ->getValidatorSchema() ->setValidator() ->getValidator()
$t->diag('->setValidators() ->setValidatorSchema() ->getValidatorSchema() ->setValidator() ->getValidator()');
$f = new FormTest();
$validators = array('first_name' => new sfValidatorPass(), 'last_name' => new sfValidatorPass());
$validatorSchema = new sfValidatorSchema($validators);
$f->setValidatorSchema($validatorSchema);
$t->is_deeply($f->getValidatorSchema(), $validatorSchema, '->setValidatorSchema() sets the current validator schema');
$f->setValidators($validators);
$schema = $f->getValidatorSchema();
$t->ok($schema['first_name'] == $validators['first_name'], '->setValidators() sets field validators');
$t->ok($schema['last_name'] == $validators['last_name'], '->setValidators() sets field validators');
$f->setValidator('name', $v3 = new sfValidatorPass());
$t->ok($f->getValidator('name') == $v3, '->setValidator() sets a validator for a field');
// ->setWidgets() ->setWidgetSchema() ->getWidgetSchema() ->getWidget() ->setWidget()
$t->diag('->setWidgets() ->setWidgetSchema() ->getWidgetSchema()');
$f = new FormTest();
$widgets = array('first_name' => new sfWidgetFormInput(), 'last_name' => new sfWidgetFormInput());
$widgetSchema = new sfWidgetFormSchema($widgets);
$f->setWidgetSchema($widgetSchema);
$t->ok($f->getWidgetSchema() == $widgetSchema, '->setWidgetSchema() sets the current widget schema');
$f->setWidgets($widgets);
$schema = $f->getWidgetSchema();
开发者ID:googlecode-mirror,项目名称:orso,代码行数:31,代码来源:sfFormTest.php

示例6: configure

        $this->lastArguments = $arguments;
        $this->lastOptions = $options;
    }
}
// ->run()
$t->diag('->run()');
class ArgumentsTest1Task extends BaseTestTask
{
    protected function configure()
    {
        $this->addArguments(array(new sfCommandArgument('foo', sfCommandArgument::REQUIRED), new sfCommandArgument('bar', sfCommandArgument::OPTIONAL)));
    }
}
$task = new ArgumentsTest1Task();
$task->run(array('FOO'));
$t->is_deeply($task->lastArguments, array('foo' => 'FOO', 'bar' => null), '->run() accepts an indexed array of arguments');
$task->run(array('foo' => 'FOO'));
$t->is_deeply($task->lastArguments, array('foo' => 'FOO', 'bar' => null), '->run() accepts an associative array of arguments');
$task->run(array('bar' => 'BAR', 'foo' => 'FOO'));
$t->is_deeply($task->lastArguments, array('foo' => 'FOO', 'bar' => 'BAR'), '->run() accepts an unordered associative array of arguments');
$task->run('FOO BAR');
$t->is_deeply($task->lastArguments, array('foo' => 'FOO', 'bar' => 'BAR'), '->run() accepts a string of arguments');
$task->run(array('foo' => 'FOO', 'bar' => null));
$t->is_deeply($task->lastArguments, array('foo' => 'FOO', 'bar' => null), '->run() accepts an associative array of arguments when optional arguments are passed as null');
$task->run(array('bar' => null, 'foo' => 'FOO'));
$t->is_deeply($task->lastArguments, array('foo' => 'FOO', 'bar' => null), '->run() accepts an unordered associative array of arguments when optional arguments are passed as null');
class ArgumentsTest2Task extends BaseTestTask
{
    protected function configure()
    {
        $this->addArguments(array(new sfCommandArgument('foo', sfCommandArgument::OPTIONAL | sfCommandArgument::IS_ARRAY)));
开发者ID:Phennim,项目名称:symfony1,代码行数:31,代码来源:sfTaskTest.php

示例7: array

/*
 * This file is part of the symfony package.
 * (c) Fabien Potencier <fabien.potencier@symfony-project.com>
 *
 * 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';
sfYaml::setSpecVersion('1.1');
$t = new lime_test(124);
// ::load()
$t->diag('::load()');
$testsForLoad = array('' => '', 'null' => null, 'false' => false, 'true' => true, '12' => 12, '"quoted string"' => 'quoted string', "'quoted string'" => 'quoted string', '12.30e+02' => 1230.0, '0x4D2' => 0x4d2, '02333' => 02333, '.Inf' => -log(0), '-.Inf' => log(0), '123456789123456789000' => '123456789123456789000', '"foo\\r\\nbar"' => "foo\r\nbar", "'foo#bar'" => 'foo#bar', "'foo # bar'" => 'foo # bar', "'#cfcfcf'" => '#cfcfcf', '2007-10-30' => mktime(0, 0, 0, 10, 30, 2007), '2007-10-30T02:59:43Z' => gmmktime(2, 59, 43, 10, 30, 2007), '2007-10-30 02:59:43 Z' => gmmktime(2, 59, 43, 10, 30, 2007), '"a \\"string\\" with \'quoted strings inside\'"' => 'a "string" with \'quoted strings inside\'', "'a \"string\" with ''quoted strings inside'''" => 'a "string" with \'quoted strings inside\'', '[foo, http://urls.are/no/mappings, false, null, 12]' => array('foo', 'http://urls.are/no/mappings', false, null, 12), '[  foo  ,   bar , false  ,  null     ,  12  ]' => array('foo', 'bar', false, null, 12), '[\'foo,bar\', \'foo bar\']' => array('foo,bar', 'foo bar'), '{foo:bar,bar:foo,false:false,null:null,integer:12}' => array('foo' => 'bar', 'bar' => 'foo', 'false' => false, 'null' => null, 'integer' => 12), '{ foo  : bar, bar : foo,  false  :   false,  null  :   null,  integer :  12  }' => array('foo' => 'bar', 'bar' => 'foo', 'false' => false, 'null' => null, 'integer' => 12), '{foo: \'bar\', bar: \'foo: bar\'}' => array('foo' => 'bar', 'bar' => 'foo: bar'), '{\'foo\': \'bar\', "bar": \'foo: bar\'}' => array('foo' => 'bar', 'bar' => 'foo: bar'), '{\'foo\'\'\': \'bar\', "bar\\"": \'foo: bar\'}' => array('foo\'' => 'bar', "bar\"" => 'foo: bar'), '{\'foo: \': \'bar\', "bar: ": \'foo: bar\'}' => array('foo: ' => 'bar', "bar: " => 'foo: bar'), '[foo, [bar, foo]]' => array('foo', array('bar', 'foo')), '[foo, {bar: foo}]' => array('foo', array('bar' => 'foo')), '{ foo: {bar: foo} }' => array('foo' => array('bar' => 'foo')), '{ foo: [bar, foo] }' => array('foo' => array('bar', 'foo')), '[  foo, [  bar, foo  ]  ]' => array('foo', array('bar', 'foo')), '[{ foo: {bar: foo} }]' => array(array('foo' => array('bar' => 'foo'))), '[foo, [bar, [foo, [bar, foo]], foo]]' => array('foo', array('bar', array('foo', array('bar', 'foo')), 'foo')), '[foo, {bar: foo, foo: [foo, {bar: foo}]}, [foo, {bar: foo}]]' => array('foo', array('bar' => 'foo', 'foo' => array('foo', array('bar' => 'foo'))), array('foo', array('bar' => 'foo'))), '[foo, bar: { foo: bar }]' => array('foo', '1' => array('bar' => array('foo' => 'bar'))));
foreach ($testsForLoad as $yaml => $value) {
    $t->is_deeply(sfYamlInline::load($yaml), $value, sprintf('::load() converts an inline YAML to a PHP structure (%s)', $yaml));
}
$testsForDump = array('null' => null, 'false' => false, 'true' => true, '12' => 12, "'quoted string'" => 'quoted string', '12.30e+02' => 1230.0, '1234' => 0x4d2, '1243' => 02333, '.Inf' => -log(0), '-.Inf' => log(0), '"foo\\r\\nbar"' => "foo\r\nbar", "'foo#bar'" => 'foo#bar', "'foo # bar'" => 'foo # bar', "'#cfcfcf'" => '#cfcfcf', "'a \"string\" with ''quoted strings inside'''" => 'a "string" with \'quoted strings inside\'', '[foo, bar, false, null, 12]' => array('foo', 'bar', false, null, 12), '[\'foo,bar\', \'foo bar\']' => array('foo,bar', 'foo bar'), '{ foo: bar, bar: foo, \'false\': false, \'null\': null, integer: 12 }' => array('foo' => 'bar', 'bar' => 'foo', 'false' => false, 'null' => null, 'integer' => 12), '{ foo: bar, bar: \'foo: bar\' }' => array('foo' => 'bar', 'bar' => 'foo: bar'), '[foo, [bar, foo]]' => array('foo', array('bar', 'foo')), '[foo, [bar, [foo, [bar, foo]], foo]]' => array('foo', array('bar', array('foo', array('bar', 'foo')), 'foo')), '{ foo: { bar: foo } }' => array('foo' => array('bar' => 'foo')), '[foo, { bar: foo }]' => array('foo', array('bar' => 'foo')), '[foo, { bar: foo, foo: [foo, { bar: foo }] }, [foo, { bar: foo }]]' => array('foo', array('bar' => 'foo', 'foo' => array('foo', array('bar' => 'foo'))), array('foo', array('bar' => 'foo'))));
// ::dump()
$t->diag('::dump()');
foreach ($testsForDump as $yaml => $value) {
    $t->is(sfYamlInline::dump($value), $yaml, sprintf('::dump() converts a PHP structure to an inline YAML (%s)', $yaml));
}
foreach ($testsForLoad as $yaml => $value) {
    if ($value == 1230) {
        continue;
    }
    $t->is_deeply(sfYamlInline::load(sfYamlInline::dump($value)), $value, 'check consistency');
}
foreach ($testsForDump as $yaml => $value) {
    if ($value == 1230) {
开发者ID:Phennim,项目名称:symfony1,代码行数:30,代码来源:sfYamlInlineTest.php

示例8: Container

<?php

require_once __DIR__ . '/../../bootstrap.php';
use greebo\essence\Container;
$t = new lime_test(8);
$container = new Container();
$container->foo = 'foo';
$container->bar = function ($c) {
    return new stdClass();
};
$t->pass('setter works properly');
$t->is_deeply($container->foo, 'foo', 'getter returns simple values properly');
$t->is_deeply($container->invalid, null, 'getter returns null on invalid keys');
$bar1 = $container->bar;
$bar2 = $container->bar;
$t->ok($bar1 instanceof stdClass, 'getter returns lazy loaded instance properly');
$t->ok($bar1 !== $bar2, 'getter returns distinct instances by default');
$container->baz = $container->shared(function ($c) {
    return new stdClass();
});
$baz1 = $container->baz;
$baz2 = $container->baz;
$t->ok($baz1 instanceof stdClass, 'getter returns lazy loaded instance properly as shared');
$t->ok($baz1 === $baz2, 'getter returns distinct instances when shared');
$t->ok(isset($container->bar) && !isset($container->invalid), 'property check works properly');
开发者ID:blerou,项目名称:greebo,代码行数:25,代码来源:ContainerTest.php

示例9: dirname

<?php

require dirname(__FILE__) . '/../bootstrap/unit.php';
require $ga_lib_dir . '/transaction/sfGoogleAnalyticsTransaction.class.php';
require $ga_lib_dir . '/transaction/sfGoogleAnalyticsItem.class.php';
$t = new lime_test(12, new lime_output_color());
$t->diag('sfGoogleAnalyticsTransaction');
$trans = new sfGoogleAnalyticsTransaction();
$t->isa_ok($trans, 'sfGoogleAnalyticsTransaction', 'transaction instantiated ok');
$t->is_deeply($trans->getValues(), array_fill(0, 8, null), 'getValues empty');
$trans->setOrderId('orderid');
$trans->setStoreName('storename');
$trans->setTotal(100);
$trans->setTax(1.25);
$trans->setShipping(4.99);
$trans->setCity('new york');
$trans->setState('ny');
$trans->setCountry('usa');
$item1 = new sfGoogleAnalyticsItem();
$item2 = new sfGoogleAnalyticsItem();
$trans->addItem($item1);
$trans->addItem($item2);
$t->is($trans->getOrderId(), 'orderid', 'order id ok');
$t->is($trans->getStoreName(), 'storename', 'store name ok');
$t->is($trans->getTotal(), 100, 'total ok');
$t->is($trans->getTax(), 1.25, 'tax ok');
$t->is($trans->getShipping(), 4.99, 'shipping ok');
$t->is($trans->getCity(), 'new york', 'city ok');
$t->is($trans->getState(), 'ny', 'state ok');
$t->is($trans->getCountry(), 'usa', 'country ok');
$t->is_deeply($trans->getItems(), array($item1, $item2), 'items ok');
开发者ID:bshaffer,项目名称:Symplist,代码行数:31,代码来源:sfGoogleAnalyticsTransactionTest.php

示例10: __construct

$t->diag('->getNumberFormat()');
$c = sfCultureInfo::getInstance();
$t->isa_ok($c->getNumberFormat(), 'sfNumberFormatInfo', '->getNumberFormat() returns a sfNumberFormatInfo instance');
// ->setNumberFormat()
$t->diag('->setNumberFormat()');
$d = $c->getNumberFormat();
$c->setNumberFormat('.');
$t->is($c->getNumberFormat(), '.', '->setNumberFormat() sets the sfNumberFormatInfo instance');
$c->NumberFormat = '#';
$t->is($c->getNumberFormat(), '#', '->setNumberFormat() is equivalent to ->NumberFormat = ');
// ->simplify()
$t->diag('->simplify()');
class myCultureInfo extends sfCultureInfo
{
    public function __construct($culture = 'en')
    {
        parent::__construct($culture);
    }
    public static function simplify($array)
    {
        return parent::simplify($array);
    }
}
$array1 = array(0 => 'hello', 1 => 'world');
$array2 = array(0 => array('hello'), 1 => 'world');
$array3 = array(0 => array('hello', 'hi'), 1 => 'world');
$ci = new myCultureInfo();
$t->isa_ok($ci->simplify($array1), 'array', '::simplify() returns an array');
$t->is_deeply($ci->simplify($array1), $array1, '::simplify() leaves 1D-arrays unchanged');
$t->is_deeply($ci->simplify($array2), $array1, '::simplify() simplifies arrays');
$t->is_deeply($ci->simplify($array3), $array3, '::simplify() leaves not-simplifiable arrays unchanged');
开发者ID:mediasadc,项目名称:alba,代码行数:31,代码来源:sfCultureInfoTest.php

示例11: dirname

<?php

require dirname(__FILE__) . '/../bootstrap/unit.php';
require dirname(__FILE__) . '/../../lib/model/sfAssetsManagerPackage.class.php';
$t = new lime_test(7, new lime_output_color());
$t->comment('Accessors');
$package = new sfAssetsManagerPackage('test');
$t->is($package->get('css'), array(), '->get() method returns an empty array by default');
$package->set('css', 'script.css');
$t->is($package->get('css'), array('script.css'), '->set() and ->get() write and read property');
$package->add('import', 'reference1');
$package->add('import', 'reference2');
$t->is($package->get('import'), array('reference1', 'reference2'), '->add() adds reference packages retrieved by ->get()');
$t->comment('Configuration from array');
$package = new sfAssetsManagerPackage('test2');
$package->fromArray(array('import' => 'reference', 'js' => 'script.js', 'css' => array('style1.css', 'style2.css')));
$t->is($package->get('import'), array('reference'), '->fromArray() inject imports property');
$t->is($package->get('js'), array('script.js'), '->fromArray() inject javascripts property');
$t->is($package->get('css'), array('style1.css', 'style2.css'), '->fromArray() inject stylesheets property');
$t->is_deeply($package->toArray(), array('import' => array('reference'), 'js' => array('script.js'), 'css' => array('style1.css', 'style2.css')), '->toArray() exports values into an array');
开发者ID:vinyll,项目名称:sfAssetsManagerPlugin,代码行数:20,代码来源:sfAssetsManagerPackageTest.php

示例12: array

$widget = dmDb::create('DmWidget', array('module' => $widgetType->getModule(), 'action' => $widgetType->getAction(), 'value' => '[]', 'dm_zone_id' => $page1->PageView->Area->Zones[0]));
$t->comment('Create a ' . $formClass . ' instance');
$form = new $formClass($widget);
$form->removeCsrfProtection();
$html = $form->render();
$t->like($html, '_^<form\\s(.|\\n)*</form>$_', 'Successfully obtained and rendered a ' . $formClass . ' instance');
$t->is(count($form->getStylesheets()), 2, 'This widget form requires 2 additional stylesheets');
$t->is(count($form->getJavascripts()), 3, 'This widget form requires 3 additional javascripts');
$t->comment('Submit an empty form');
$form->bind(array(), array());
$t->is($form->isValid(), true, 'The form is  valid');
$t->comment('Save the widget');
$form->updateWidget()->save();
$t->ok($widget->exists(), 'Widget has been saved');
$expected = array('ulClass' => '', 'liClass' => '', 'items' => array());
$t->is_deeply($widget->values, $expected, 'Widget values are correct');
$t->comment('Recreate the form from the saved widget');
$form = new $formClass($widget);
$form->removeCsrfProtection();
$t->is($form->getDefault('link'), array(), 'The form default text is correct');
$t->is($form->getDefault('text'), array(), 'The form default link is correct');
$t->comment('Submit form without additional data');
$form->bind(array(), array());
$t->is($form->isValid(), true, 'The form is valid');
if (!$form->isValid()) {
    $t->comment($form->getErrorSchema()->getMessage());
}
$t->comment('Add an item');
$form->bind(array('link' => array('page:1'), 'text' => array('Home'), 'depth' => 0, 'cssClass' => 'test css_class'), array());
$t->is($form->isValid(), true, 'The form is valid');
if (!$form->isValid()) {
开发者ID:vjousse,项目名称:diem,代码行数:31,代码来源:dmWidgetNavigationMenuTest.php

示例13: setup

<?php

/*
 * This file is part of the symfony package.
 * (c) 2004-2006 Fabien Potencier <fabien.potencier@symfony-project.com>
 *
 * 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(1);
class ProjectConfiguration extends sfProjectConfiguration
{
    public function setup()
    {
        $this->enablePlugins('sfPropelORMPlugin');
        sfConfig::set('sf_plugins_dir', sfConfig::get('sf_root_dir') . '/../../../');
    }
}
new ProjectConfiguration();
// ->__construct()
$t->diag('->__construct()');
$configuration = array('propel' => array('datasources' => array('propel' => array('adapter' => 'mysql', 'connection' => array('dsn' => 'mysql:dbname=testdb;host=localhost', 'user' => 'foo', 'password' => 'bar', 'classname' => 'PropelPDO', 'options' => array('ATTR_PERSISTENT' => true, 'ATTR_AUTOCOMMIT' => false), 'settings' => array('charset' => array('value' => 'utf8'), 'queries' => array())), 'slaves' => array()), 'default' => 'propel')));
$parametersTests = array('dsn' => 'mysql:dbname=testdb;host=localhost', 'username' => 'foo', 'password' => 'bar', 'encoding' => 'utf8', 'persistent' => true, 'options' => array('ATTR_AUTOCOMMIT' => false));
$p = new sfPropelDatabase($parametersTests);
$t->is_deeply($p->getConfiguration(), $configuration, '->__construct() creates a valid propel configuration from parameters');
开发者ID:propelorm,项目名称:sfPropelORMPlugin,代码行数:26,代码来源:sfPropelDatabaseTest.php

示例14: array

$t->diag('Initialization');
$b = $sc->reload('web_browser');
$t->is($b->getUserAgent(), 'Project (?) Diem/' . DIEM_VERSION . ' (http://diem-project.org)', 'a new browser has a default user agent: ' . $b->getUserAgent());
$t->is($b->getResponseText(), '', 'a new browser has an empty response');
$t->is($b->getResponseCode(), '', 'a new browser has an empty response code');
$t->is($b->getResponseHeaders(), array(), 'a new browser has empty reponse headers');
/*******************/
/* Utility methods */
/*******************/
$t->diag('Utility methods');
$b = $sc->reload('web_browser');
$t->is($b->setUserAgent('foo bar')->getUserAgent(), 'foo bar', 'setUserAgent() sets the user agent');
$t->is($b->setResponseText('foo bar')->getResponseText(), 'foo bar', 'setResponseText() extracts the response');
$t->is($b->setResponseCode('foo 123 bar')->getResponseCode(), '123', 'setResponseCode() extracts the three-digits code');
$t->is($b->setResponseCode('foo 12 bar')->getResponseCode(), '', 'setResponseCode() fails silently when response status is incorrect');
$t->is_deeply($b->setResponseHeaders(array('HTTP1.1 200 OK', 'foo: bar', 'bar: baz'))->getResponseHeaders(), array('Foo' => 'bar', 'Bar' => 'baz'), 'setResponseHeaders() extracts the headers array');
$t->is_deeply($b->setResponseHeaders(array('ETag: "535a8-9fb-44ff4a13"', 'WWW-Authenticate: Basic realm="Myself"'))->getResponseHeaders(), array('ETag' => '"535a8-9fb-44ff4a13"', 'WWW-Authenticate' => 'Basic realm="Myself"'), 'setResponseHeaders() extracts the headers array and accepts response headers with several uppercase characters');
$t->is_deeply($b->setResponseHeaders(array('HTTP1.1 200 OK', 'foo: bar', 'bar:baz', 'baz:bar'))->getResponseHeaders(), array('Foo' => 'bar'), 'setResponseHeaders() ignores malformed headers');
/**************/
/* Exceptions */
/**************/
$t->diag('Exceptions');
$b = $sc->reload('web_browser');
try {
    $b->get('htp://askeet');
    $t->fail('get() throws an exception when passed an uri which is neither http nor https');
} catch (Exception $e) {
    $t->pass('get() throws an exception when passed an uri which is neither http nor https');
}
/**********************/
/* Simple GET request */
开发者ID:jdart,项目名称:diem,代码行数:31,代码来源:dmWebBrowserTest.php

示例15: MyForm

$output = <<<EOF
<link rel="stylesheet" type="text/css" media="all" href="/path/to/a/foo.css" />
<link rel="stylesheet" type="text/css" media="print" href="/path/to/a/bar.css" />

EOF;
$t->is(get_stylesheets_for_form($form), fix_linebreaks($output), 'get_stylesheets_for_form() returns link tags');

// use_javascripts_for_form() use_stylesheets_for_form()
$t->diag('use_javascripts_for_form() use_stylesheets_for_form()');

$response = sfContext::getInstance()->getResponse();
$form = new MyForm();

$response->resetAssets();
use_stylesheets_for_form($form);
$t->is_deeply($response->getStylesheets(), array('/path/to/a/foo.css' => array('media' => 'all'), '/path/to/a/bar.css' => array('media' => 'print')), 'use_stylesheets_for_form() adds stylesheets to the response');

$response->resetAssets();
use_javascripts_for_form($form);
$t->is_deeply($response->getJavaScripts(), array('/path/to/a/foo.js' => array(), '/path/to/a/bar.js' => array()), 'use_javascripts_for_form() adds javascripts to the response');

// custom web paths
$t->diag('Custom asset path handling');

sfConfig::set('sf_web_js_dir_name', 'static/js');
$t->is(javascript_path('xmlhr'), '/static/js/xmlhr.js', 'javascript_path() decorates a relative filename with js dir name and extension with custom js dir');
$t->is(javascript_include_tag('xmlhr'),
  '<script type="text/javascript" src="/static/js/xmlhr.js"></script>'."\n",
  'javascript_include_tag() takes a javascript name as its first argument');

sfConfig::set('sf_web_css_dir_name', 'static/css');
开发者ID:nationalfield,项目名称:symfony,代码行数:31,代码来源:AssetHelperTest.php


注:本文中的lime_test::is_deeply方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。