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


PHP ok函数代码示例

本文整理汇总了PHP中ok函数的典型用法代码示例。如果您正苦于以下问题:PHP ok函数的具体用法?PHP ok怎么用?PHP ok使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: testAdditionalEnabledVariants

 public function testAdditionalEnabledVariants()
 {
     $variants = array('sqlite' => true);
     $settings = new DefaultBuildSettings(array('enabled_variants' => $variants));
     ok($settings->getVariant('sqlite'));
     ok($settings->isEnabledVariant('curl'));
 }
开发者ID:WebDevJL,项目名称:phpbrew,代码行数:7,代码来源:DefaultBuildSettingsTest.php

示例2: testBasicView

 public function testBasicView()
 {
     $action = new CreateUserAction();
     ok($action);
     $view = new ActionKit\View\StackView($action);
     ok($view);
     $html = $view->render();
     ok($html);
     $resultDom = new DOMDocument();
     $resultDom->loadXML($html);
     $finder = new DomXPath($resultDom);
     $nodes = $finder->query("//form");
     is(1, $nodes->length);
     $nodes = $finder->query("//input");
     is(4, $nodes->length);
     $nodes = $finder->query("//*[contains(@class, 'formkit-widget')]");
     is(8, $nodes->length);
     $nodes = $finder->query("//*[contains(@class, 'formkit-widget-text')]");
     is(2, $nodes->length);
     $nodes = $finder->query("//*[contains(@class, 'formkit-label')]");
     is(3, $nodes->length);
     $nodes = $finder->query("//input[@name='last_name']");
     is(1, $nodes->length);
     $nodes = $finder->query("//input[@name='first_name']");
     is(1, $nodes->length);
 }
开发者ID:corneltek,项目名称:actionkit,代码行数:26,代码来源:StackViewTest.php

示例3: init

 /**
  * Инициализация управления вложениями
  * @return null
  */
 public function init()
 {
     /* @var $attach attachments */
     $attach = n("attachments");
     $act = $_GET["act"];
     switch ($act) {
         case "upload":
             $type = $_GET["type"];
             $toid = $_GET["toid"];
             $ret = $attach->change_type($type)->upload($toid);
             ok(true);
             print $ret;
             break;
         case "download":
             $attach_id = (int) $_GET["id"];
             $preview = (int) $_GET["preview"];
             $attach->download($attach_id, $preview);
             break;
         case "delete":
             $attach_id = $_POST["id"];
             $ret = $attach->delete($attach_id);
             if (!$ret) {
                 throw new Exception();
             }
             ok();
             break;
     }
     die;
 }
开发者ID:SjayLiFe,项目名称:CTRev,代码行数:33,代码来源:attach_manage.php

示例4: testExcept

 function testExcept()
 {
     $v = new ValidationKit\StringValidator(array('except' => 'aaa'));
     ok($v);
     ok($v->validate('Find the position of the first occurrence of a substring in a string'));
     not_ok($v->validate('Find the aaa of the first occurrence of a substring in a string'));
 }
开发者ID:racklin,项目名称:ValidationKit,代码行数:7,代码来源:StringValidatorTest.php

示例5: testSQLiteTableParser

 public function testSQLiteTableParser()
 {
     $pdo = new PDO('sqlite::memory:');
     $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
     ok($pdo);
     $pdo->query('CREATE TABLE foo ( id integer primary key autoincrement, name varchar(12), phone varchar(32) unique , address text not null );');
     $pdo->query('CREATE TABLE bar ( id integer primary key autoincrement, confirmed boolean default false, content blob );');
     $parser = new SqliteTableParser(new PDOSQLiteDriver($pdo), $pdo);
     $tables = $parser->getTables();
     $this->assertNotEmpty($tables);
     $this->assertCount(2, $tables);
     $sql = $parser->getTableSql('foo');
     ok($sql);
     $columns = $parser->parseTableSql('foo');
     $this->assertNotEmpty($columns);
     $columns = $parser->parseTableSql('bar');
     $this->assertNotEmpty($columns);
     $schema = $parser->reverseTableSchema('bar');
     $this->assertNotNull($schema);
     $id = $schema->getColumn('id');
     $this->assertNotNull($id);
     $this->assertTrue($id->autoIncrement);
     $this->assertEquals('INTEGER', $id->type);
     $this->assertEquals('int', $id->isa);
     $this->assertTrue($id->primary);
 }
开发者ID:appleboy,项目名称:LazyRecord,代码行数:26,代码来源:SqliteTableParserTest.php

示例6: testSchemaGenerator

 public function testSchemaGenerator()
 {
     $g = new SchemaGenerator($this->config, $this->logger);
     $g->setForceUpdate(true);
     $schemas = $this->getModels();
     foreach ($schemas as $schema) {
         if ($result = $g->generateCollectionClass($schema)) {
             list($class, $file) = $result;
             ok($class);
             ok($file);
             path_ok($file);
             $this->syntaxTest($file);
         }
         if ($classMap = $g->generate(array($schema))) {
             foreach ($classMap as $class => $file) {
                 ok($class);
                 ok($file);
                 path_ok($file, $file);
                 // $this->syntaxTest($file);
                 require_once $file;
             }
         }
         $pk = $schema->findPrimaryKey();
         $this->assertNotNull($pk, "Find primary key from " . get_class($schema));
         $model = $schema->newModel();
         $this->assertNotNull($model);
         $collection = $schema->newCollection();
         $this->assertNotNull($collection);
     }
 }
开发者ID:corneltek,项目名称:lazyrecord,代码行数:30,代码来源:SchemaGeneratorTest.php

示例7: is_deeply

function is_deeply($a, $b, $name = null)
{
    if ($name === null) {
        $name = 'is_deeply';
    }
    ok(deep_array_compare($a, $b), $name);
}
开发者ID:mihai-stancu,项目名称:sereal,代码行数:7,代码来源:TestMore.php

示例8: test

 function test()
 {
     $validator = new CallbackValidator(function ($value) {
         return true;
     });
     ok($validator->validate(123));
 }
开发者ID:racklin,项目名称:ValidationKit,代码行数:7,代码来源:CallbackValidatorTest.php

示例9: test

 function test()
 {
     $store = $this->getStore();
     ok($store);
     $store->destroy();
     $store->load();
     $user = new \Phifty\JsonStore\FileJsonModel('User', $store);
     $id = $user->save(array('name' => 123));
     ok($id);
     $store->save();
     $items = $store->items();
     ok($items);
     count_ok(1, $items);
     $user = new \Phifty\JsonStore\FileJsonModel('User', $store);
     $id = $user->save(array('name' => 333));
     ok($id);
     $items = $store->items();
     ok($items);
     count_ok(2, $items);
     $user = new \Phifty\JsonStore\FileJsonModel('User', $store);
     $id = $user->save(array('id' => 99, 'name' => 'with Id'));
     ok($id);
     ok($store->get(99));
     ok($store->get("99"));
     $items = $store->items();
     ok($items);
     count_ok(3, $items);
     ok($store->destroy());
 }
开发者ID:corneltek,项目名称:phifty,代码行数:29,代码来源:JsonStoreFileTest.php

示例10: testGetRegionId

 public function testGetRegionId()
 {
     $region = new Region('/bs/news/crud/edit', array('id' => 1));
     $id = $region->getRegionId();
     ok($id);
     ok($region->render());
 }
开发者ID:corneltek,项目名称:phifty,代码行数:7,代码来源:RegionTest.php

示例11: test

 function test()
 {
     $username = new FormKit\Widget\TextInput('username', array('label' => 'Username'));
     $username->value('default')->maxlength(10)->minlength(3)->size(20);
     $password = new FormKit\Widget\PasswordInput('password', array('label' => 'Password'));
     $remember = new FormKit\Widget\CheckboxInput('remember', array('label' => 'Remember me'));
     $remember->value(12);
     $remember->check();
     $widgets = new FormKit\WidgetCollection();
     ok($widgets);
     $widgets->add($username);
     $widgets->add($password);
     $widgets->add($remember);
     // get __get method
     is($username, $widgets->username);
     is($password, $widgets->password);
     is($username, $widgets->get('username'));
     ok($widgets->render('username'));
     ok(is_array($widgets->getJavascripts()));
     ok(is_array($widgets->getStylesheets()));
     is(3, $widgets->size());
     $widgets->remove($username);
     is(2, $widgets->size());
     unset($widgets['password']);
     is(1, $widgets->size());
 }
开发者ID:corneltek,项目名称:formkit,代码行数:26,代码来源:WidgetCollectionTest.php

示例12: init

 /**
  * Инициализация Ajax-части чата
  * @return null
  */
 public function init()
 {
     lang::o()->get("blocks/chat");
     $id = (int) $_GET['id'];
     switch ($_GET["act"]) {
         case "text":
             $this->get_text($id);
             die;
             break;
         case "delete":
             $this->delete($id);
             ok();
             break;
         case "truncate":
             $this->truncate();
             die(lang::o()->v('chat_no_messages'));
             break;
         case "save":
             $this->save($_POST['text'], $id);
             ok();
             break;
         default:
             $this->show((int) $_GET['time'], (bool) $_GET['prev']);
             break;
     }
 }
开发者ID:SjayLiFe,项目名称:CTRev,代码行数:30,代码来源:chat.php

示例13: test

 public function test()
 {
     $con = new ProductResourceController();
     ok($con);
     $routes = $con->getActionRoutes();
     ok($routes);
     $methods = $con->getActionMethods();
     ok($methods);
     $productMux = $con->expand();
     // there is a sorting bug (fixed), this tests it.
     ok($productMux);
     $root = new Mux();
     ok($root);
     $root->mount('/product', $con->expand());
     $_SERVER['REQUEST_METHOD'] = 'GET';
     ok($root->dispatch('/product/10'));
     $_SERVER['REQUEST_METHOD'] = 'DELETE';
     ok($root->dispatch('/product/10'));
     $_SERVER['REQUEST_METHOD'] = 'POST';
     ok($root->dispatch('/product'));
     // create
     $_SERVER['REQUEST_METHOD'] = 'POST';
     ok($root->dispatch('/product/10'));
     // update
 }
开发者ID:magicdice,项目名称:Pux,代码行数:25,代码来源:RESTfulControllerTest.php

示例14: test

 function test()
 {
     $region = new Phifty\Web\Region('/bs/news/crud/edit', array('id' => 1));
     $id = $region->getRegionId();
     ok($id);
     ok($region->render());
 }
开发者ID:azole,项目名称:Phifty,代码行数:7,代码来源:RegionTest.php

示例15: testSetQuiet

 public function testSetQuiet()
 {
     $make = new MakeTask($this->createLogger(), new OptionResult());
     not_ok($make->isQuiet());
     $make->setQuiet();
     ok($make->isQuiet());
 }
开发者ID:phpbrew,项目名称:phpbrew,代码行数:7,代码来源:MakeTaskTest.php


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