本文整理汇总了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'));
}
示例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);
}
示例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;
}
示例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'));
}
示例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);
}
示例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);
}
}
示例7: is_deeply
function is_deeply($a, $b, $name = null)
{
if ($name === null) {
$name = 'is_deeply';
}
ok(deep_array_compare($a, $b), $name);
}
示例8: test
function test()
{
$validator = new CallbackValidator(function ($value) {
return true;
});
ok($validator->validate(123));
}
示例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());
}
示例10: testGetRegionId
public function testGetRegionId()
{
$region = new Region('/bs/news/crud/edit', array('id' => 1));
$id = $region->getRegionId();
ok($id);
ok($region->render());
}
示例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());
}
示例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;
}
}
示例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
}
示例14: test
function test()
{
$region = new Phifty\Web\Region('/bs/news/crud/edit', array('id' => 1));
$id = $region->getRegionId();
ok($id);
ok($region->render());
}
示例15: testSetQuiet
public function testSetQuiet()
{
$make = new MakeTask($this->createLogger(), new OptionResult());
not_ok($make->isQuiet());
$make->setQuiet();
ok($make->isQuiet());
}