當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。