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


PHP count_ok函数代码示例

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


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

示例1: 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

示例2: testMuxCompiler

 public function testMuxCompiler()
 {
     $mux = new Mux();
     $mux->add('/hello/:name', array('FooController', 'index'));
     $mux->compile("hello_mux.php");
     $mux2 = new Mux();
     $mux2->add('/bye/:name', array('FooController', 'index'));
     $mux2->compile("bye_mux.php");
     $compiler = new MuxCompiler();
     ok($compiler->load("hello_mux.php"));
     ok($compiler->load("bye_mux.php"));
     $compiler->compileReflectionParameters();
     ok($compiler->compile("merged_mux.php"));
     path_ok("merged_mux.php");
     $mux = (require "merged_mux.php");
     ok($mux);
     $routes = $mux->getRoutes();
     ok($routes);
     count_ok(2, $routes);
     ok($mux->dispatch('/hello/John'));
     ok($mux->dispatch('/bye/John'));
     unlink("merged_mux.php");
     unlink("hello_mux.php");
     unlink("bye_mux.php");
 }
开发者ID:jbboehr,项目名称:pux,代码行数:25,代码来源:MuxCompilerTest.php

示例3: testExpand

 /**
  * @depends testControllerConstructor
  */
 public function testExpand($controller)
 {
     $mux = $controller->expand();
     ok($mux);
     ok($routes = $mux->getRoutes());
     count_ok(3, $routes);
 }
开发者ID:router-front,项目名称:Pux,代码行数:10,代码来源:ControllerTest.php

示例4: testGetRoutes

 public function testGetRoutes()
 {
     $submux = new \Pux\Mux();
     $submux->any('/hello/:name', array('HelloController2', 'indexAction'));
     ok($submux);
     ok($routes = $submux->getRoutes());
     ok(is_array($routes));
     count_ok(1, $routes);
 }
开发者ID:ruckfull,项目名称:Pux,代码行数:9,代码来源:MuxMountTest.php

示例5: test3

 function test3()
 {
     $arg = new Argument('-abc');
     ok($arg->withExtraFlagOptions());
     $args = $arg->extractExtraFlagOptions();
     ok($args);
     count_ok(2, $args);
     is('-b', $args[0]);
     is('-c', $args[1]);
     is('-a', $arg->arg);
 }
开发者ID:kilmas,项目名称:framework,代码行数:11,代码来源:ArgumentTest.php

示例6: testExport

 /**
  * @depends testBasicRoutes
  */
 public function testExport($mux)
 {
     $code = $mux->export();
     ok($code);
     eval('$newMux = ' . $code . ';');
     ok($newMux);
     $routes = $newMux->getRoutes();
     ok($routes);
     count_ok(2, $routes);
     is(2, $newMux->length());
 }
开发者ID:kpb90,项目名称:Pux,代码行数:14,代码来源:MuxExportTest.php

示例7: testMuxGetMethod

 public function testMuxGetMethod()
 {
     $mux = new \Pux\Mux();
     ok($mux);
     $mux->get('/news', ['NewsController', 'listAction']);
     $mux->get('/news_item', ['NewsController', 'itemAction'], []);
     $routes = $mux->getRoutes();
     ok($routes);
     count_ok(2, $routes);
     is(2, $mux->length());
     $_SERVER['REQUEST_METHOD'] = "GET";
     ok($mux->dispatch('/news_item'));
     ok($mux->dispatch('/news'));
 }
开发者ID:magicdice,项目名称:Pux,代码行数:14,代码来源:MuxConditionTest.php

示例8: testAnnotationForGetActionMethods

 public function testAnnotationForGetActionMethods()
 {
     $con = new ChildController();
     ok($con);
     ok($map = $con->getActionMethods());
     ok(is_array($map));
     ok(isset($map['postAction']));
     ok(isset($map['pageAction']));
     ok(isset($map['subpageAction']));
     is(array(array("Route" => "/post", "Method" => "POST"), array("class" => "ChildController")), $map['postAction']);
     $routeMap = $con->getActionRoutes();
     count_ok(3, $routeMap);
     list($path, $method, $options) = $routeMap[0];
     is('/page', $path);
     is('pageAction', $method);
     is(array('method' => REQUEST_METHOD_GET), $options);
 }
开发者ID:ruckfull,项目名称:Pux,代码行数:17,代码来源:ControllerAnnotationTest.php

示例9: testParser3

 function testParser3()
 {
     $appspecs = new OptionSpecCollection();
     $appspecs->add('v|verbose');
     $appspecs->add('c|color');
     $appspecs->add('d|debug');
     $cmdspecs = new OptionSpecCollection();
     $cmdspecs->add('a');
     $cmdspecs->add('b');
     $cmdspecs->add('c');
     $subcommands = array('subcommand1', 'subcommand2', 'subcommand3');
     $subcommand_specs = array('subcommand1' => $cmdspecs, 'subcommand2' => $cmdspecs, 'subcommand3' => $cmdspecs);
     $subcommand_options = array();
     $arguments = array();
     $argv = explode(' ', 'program -v -d -c subcommand1 -a -b -c subcommand2 -c subcommand3 arg1 arg2 arg3');
     $parser = new ContinuousOptionParser($appspecs);
     ok($parser);
     $app_options = $parser->parse($argv);
     while (!$parser->isEnd()) {
         if (@$subcommands[0] && $parser->getCurrentArgument() == $subcommands[0]) {
             $parser->advance();
             $subcommand = array_shift($subcommands);
             $parser->setSpecs($subcommand_specs[$subcommand]);
             $subcommand_options[$subcommand] = $parser->continueParse();
         } else {
             $arguments[] = $parser->advance();
         }
     }
     count_ok(3, $arguments);
     is('arg1', $arguments[0]);
     is('arg2', $arguments[1]);
     is('arg3', $arguments[2]);
     ok($subcommand_options);
     ok($subcommand_options['subcommand1']);
     ok($subcommand_options['subcommand1']->a);
     ok($subcommand_options['subcommand1']->b);
     ok($subcommand_options['subcommand1']->c);
     ok($subcommand_options['subcommand2']);
     ok(!$subcommand_options['subcommand2']->a);
     ok(!$subcommand_options['subcommand2']->b);
     ok($subcommand_options['subcommand2']->c);
     ok($subcommand_options['subcommand3']);
 }
开发者ID:kilmas,项目名称:framework,代码行数:43,代码来源:ContinuousOptionParserTest.php

示例10: testManyToManyRelationFetch

 public function testManyToManyRelationFetch()
 {
     $author = new Author();
     $author->create(array('name' => 'Z', 'email' => 'z@z', 'identity' => 'z'));
     // XXX: in different database engine, it's different.
     // sometimes it's string, sometimes it's integer
     // ok( is_string( $author->getValue('id') ) );
     ok(is_integer($author->get('id')));
     $book = $author->books->create(array('title' => 'Book Test'));
     ok($book);
     ok($book->id, 'book is created');
     $ret = $book->delete();
     ok($ret->success);
     $ab = new \AuthorBooks\Model\AuthorBook();
     $book = new \AuthorBooks\Model\Book();
     // should not include this
     ok($book->create(array('title' => 'Book I Ex'))->success);
     ok($book->create(array('title' => 'Book I'))->success);
     ok($ab->create(array('author_id' => $author->id, 'book_id' => $book->id))->success);
     ok($book->create(array('title' => 'Book II'))->success);
     $ab->create(array('author_id' => $author->id, 'book_id' => $book->id));
     ok($book->create(array('title' => 'Book III'))->success);
     $ab->create(array('author_id' => $author->id, 'book_id' => $book->id));
     // retrieve books from relationshipt
     $author->flushCache();
     $books = $author->books;
     is(3, $books->size(), 'We have 3 books');
     $bookTitles = array();
     foreach ($books->items() as $item) {
         $bookTitles[$item->title] = true;
         $item->delete();
     }
     count_ok(3, array_keys($bookTitles));
     ok($bookTitles['Book I']);
     ok($bookTitles['Book II']);
     ok($bookTitles['Book III']);
     ok(!isset($bookTitles['Book I Ex']));
     $author->delete();
 }
开发者ID:corneltek,项目名称:lazyrecord,代码行数:39,代码来源:AuthorBookModelTest.php

示例11: testMountNoExpand

 /**
  * @depends testControllerConstructor
  */
 public function testMountNoExpand($controller)
 {
     $mainMux = new Mux();
     $mainMux->expand = false;
     $mainMux->mount('/product', $controller);
     $mainMux->any('/', array('ProductController', 'indexAction'));
     ok($mainMux->getRoutes());
     count_ok(2, $mainMux->getRoutes(), 'route count should be 2');
     ok($r = $mainMux->dispatch('/product'), 'matched /product');
     // match indexAction
     $this->assertSame(array('CRUDProductController', 'indexAction'), $r[2]);
     ok($r = $mainMux->dispatch('/product/add'));
     $this->assertSame(array('CRUDProductController', 'addAction'), $r[2]);
     ok($r = $mainMux->dispatch('/product/del'));
     $this->assertSame(array('CRUDProductController', 'delAction'), $r[2]);
     ok(null == $mainMux->dispatch('/foo'));
     ok(null == $mainMux->dispatch('/bar'));
 }
开发者ID:kpb90,项目名称:Pux,代码行数:21,代码来源:ControllerTest.php

示例12: testManyToManyRelationFetchRecord

 public function testManyToManyRelationFetchRecord()
 {
     $author = new \AuthorBooks\Model\Author();
     $author->create(array('name' => 'Z', 'email' => 'z@z', 'identity' => 'z'));
     $book = $author->books->create(array('title' => 'Book Test'));
     ok($book);
     ok($book->id, 'book is created');
     $ret = $book->delete();
     ok($ret->success);
     $ab = new \AuthorBooks\Model\AuthorBook();
     $book = new \AuthorBooks\Model\Book();
     // should not include this
     ok($book->create(array('title' => 'Book I Ex'))->success);
     ok($book->create(array('title' => 'Book I'))->success);
     result_ok($ab->create(array('author_id' => $author->id, 'book_id' => $book->id)));
     ok($book->create(array('title' => 'Book II'))->success);
     $ab->create(array('author_id' => $author->id, 'book_id' => $book->id));
     ok($book->create(array('title' => 'Book III'))->success);
     $ab->create(array('author_id' => $author->id, 'book_id' => $book->id));
     // retrieve books from relationshipt
     $author->flushCache();
     $books = $author->books;
     is(3, $books->size(), 'We have 3 books');
     $bookTitles = array();
     foreach ($books->items() as $item) {
         $bookTitles[$item->title] = true;
         $item->delete();
     }
     count_ok(3, array_keys($bookTitles));
     ok($bookTitles['Book I']);
     ok($bookTitles['Book II']);
     ok($bookTitles['Book III']);
     ok(!isset($bookTitles['Book I Ex']));
     $author->delete();
 }
开发者ID:azole,项目名称:LazyRecord,代码行数:35,代码来源:BasicCRUDTest.php

示例13: testModelColumnDefaultValueBuilder

 public function testModelColumnDefaultValueBuilder()
 {
     $name = new \TestApp\Model\Name();
     $ret = $name->create(array('name' => 'Foo', 'country' => 'Taiwan'));
     $this->assertResultSuccess($ret);
     $this->assertNotEmpty($ret->validations);
     $this->assertTrue(isset($ret->validations['address']));
     $this->assertTrue($ret->validations['address']['valid']);
     ok($vlds = $ret->getSuccessValidations());
     count_ok(1, $vlds);
     ok($name->id);
     ok($name->address);
     $ret = $name->create(array('name' => 'Foo', 'address' => 'fuck', 'country' => 'Tokyo'));
     ok($ret->validations);
     foreach ($ret->getErrorValidations() as $vld) {
         $this->assertFalse($vld['valid']);
         $this->assertEquals('Please don\'t', $vld['message']);
     }
 }
开发者ID:nilportugues-php-tools,项目名称:LazyRecord,代码行数:19,代码来源:NameModelTest.php

示例14: testSpecCollection

 public function testSpecCollection()
 {
     $this->specs->add('f|foo:', 'option requires a value.');
     $this->specs->add('b|bar+', 'option with multiple value.');
     $this->specs->add('z|zoo?', 'option with optional value.');
     $this->specs->add('v|verbose', 'verbose message.');
     $this->specs->add('d|debug', 'debug message.');
     $this->specs->add('long', 'long option name only.');
     $this->specs->add('s', 'short option name only.');
     ok($this->specs->all());
     ok($this->specs);
     count_ok(7, $array = $this->specs->toArray());
     $this->assertNotEmpty(isset($array[0]['long']));
     $this->assertNotEmpty(isset($array[0]['short']));
     $this->assertNotEmpty(isset($array[0]['desc']));
 }
开发者ID:websharks,项目名称:GetOptionKit,代码行数:16,代码来源:GetOptionKitTest.php

示例15: testSpecCollection

 function testSpecCollection()
 {
     $opt = new \GetOptionKit\GetOptionKit();
     ok($opt);
     $opt->add('f|foo:', 'option requires a value.');
     $opt->add('b|bar+', 'option with multiple value.');
     $opt->add('z|zoo?', 'option with optional value.');
     $opt->add('v|verbose', 'verbose message.');
     $opt->add('d|debug', 'debug message.');
     $opt->add('long', 'long option name only.');
     $opt->add('s', 'short option name only.');
     ok($opt->specs->all());
     ok($opt->specs);
     ok($opt->getSpecs());
     count_ok(7, $array = $opt->specs->toArray());
     ok(isset($array[0]['long']));
     ok(isset($array[0]['short']));
     ok(isset($array[0]['description']));
     ob_start();
     $opt->specs->printOptions();
     $content = ob_get_contents();
     ob_clean();
     like('/option with/m', $content);
     # echo "\n".$content;
 }
开发者ID:kilmas,项目名称:framework,代码行数:25,代码来源:GetOptionKitTest.php


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