• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP is函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: testUserRelationshipReturnsModel

 public function testUserRelationshipReturnsModel()
 {
     $meta = Factory::create('PostMeta', ['meta_key' => 'pal_user_id', 'meta_value' => 1]);
     Factory::create('User', ['id' => 1]);
     $user = $meta->user;
     assertThat($user, is(anInstanceof('User')));
 }
开发者ID:estebanmatias92,项目名称:pull-automatically-galleries,代码行数:7,代码来源:PostMetaTest.php


示例2: testAppendMetaAndContentText

 public function testAppendMetaAndContentText()
 {
     $this->pagedResult->appendMetaText(self::META_TEXT);
     $this->pagedResult->appendContentText(self::CONTENT_TEXT);
     assertThat($this->pagedResult->getCurrentOffset(), is(self::START_OFFSET + strlen(self::CONTENT_TEXT)));
     assertThat($this->pagedResult->getText(), is(self::META_TEXT . self::CONTENT_TEXT));
 }
开发者ID:DanielDobre,项目名称:fossology,代码行数:7,代码来源:PagedResultTest.php


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


示例4: _findActorIdentifiers

 /**
  * Return an array of actor identifiers
  *
  * @return array
  */
 protected static function _findActorIdentifiers(KServiceInterface $container)
 {
     $components = $container->get('repos://admin/components.component')->getQuery()->enabled(true)->fetchSet();
     $components = array_unique($container->get('repos://admin/components.component')->fetchSet()->component);
     $identifiers = array();
     foreach ($components as $component) {
         $path = JPATH_SITE . '/components/' . $component . '/domains/entities';
         if (!file_exists($path)) {
             continue;
         }
         //get all the files
         $files = (array) JFolder::files($path);
         //convert com_<Component> to ['com','<Name>']
         $parts = explode('_', $component);
         $identifier = new KServiceIdentifier('com:' . substr($component, strpos($component, '_') + 1));
         $identifier->path = array('domain', 'entity');
         foreach ($files as $file) {
             $identifier->name = substr($file, 0, strpos($file, '.'));
             try {
                 if (is($identifier->classname, 'ComActorsDomainEntityActor')) {
                     $identifiers[] = clone $identifier;
                 }
             } catch (Exception $e) {
             }
         }
     }
     return $identifiers;
 }
开发者ID:walteraries,项目名称:anahita,代码行数:33,代码来源:actoridentifier.php


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


示例6: testRouteExecutor

 public function testRouteExecutor()
 {
     $mux = new \Pux\Mux();
     ok($mux);
     $mux->add('/hello/:name', array('HelloController2', 'helloAction'), array('require' => array('name' => '\\w+')));
     $mux->add('/product/:id', array('ProductController', 'itemAction'));
     $mux->add('/product', array('ProductController', 'listAction'));
     $mux->add('/foo', array('ProductController', 'fooAction'));
     $mux->add('/bar', array('ProductController', 'barAction'));
     $mux->add('/', array('ProductController', 'indexAction'));
     ok($r = $mux->dispatch('/'));
     is('index', RouteExecutor::execute($r));
     ok($r = $mux->dispatch('/foo'));
     is('foo', RouteExecutor::execute($r));
     ok($r = $mux->dispatch('/bar'));
     is('bar', RouteExecutor::execute($r));
     // XXX: seems like a gc bug here
     return;
     $cb = function () use($mux) {
         $r = $mux->dispatch('/product/23');
         RouteExecutor::execute($r);
     };
     for ($i = 0; $i < 100; $i++) {
         call_user_func($cb);
     }
     for ($i = 0; $i < 100; $i++) {
         ok($r = $mux->dispatch('/product/23'));
         is('product item 23', RouteExecutor::execute($r));
     }
     ok($r = $mux->dispatch('/hello/john'));
     is('hello john', RouteExecutor::execute($r));
 }
开发者ID:router-front,项目名称:Pux,代码行数:32,代码来源:MuxExecutorTest.php


示例7: testRenderContentTextConvertsToUtf8

 public function testRenderContentTextConvertsToUtf8()
 {
     $this->pagedTextResult->appendContentText("äöü");
     $expected = htmlspecialchars("äöü", ENT_SUBSTITUTE, 'UTF-8');
     assertThat($this->pagedTextResult->getText(), is(equalTo($expected)));
     $this->addToAssertionCount(1);
 }
开发者ID:DanielDobre,项目名称:fossology,代码行数:7,代码来源:PagedTextResultTest.php


示例8: testInitializeDirsAndFiles

 public function testInitializeDirsAndFiles()
 {
     /**
      * dirs and files to create.
      */
     $dirs = [__DIR__ . '/../../../sql', __DIR__ . '/../../../.dbup/applied', __DIR__ . '/../../../.dbup'];
     $files = [__DIR__ . '/../../../sql/V1__sample_select.sql', __DIR__ . '/../../../.dbup/properties.ini'];
     /**
      * cleaner the created files and dirs.
      */
     $clean = function () use($dirs, $files) {
         foreach ($files as $file) {
             @unlink($file);
         }
         foreach ($dirs as $dir) {
             @rmdir($dir);
         }
     };
     $clean();
     $application = new Application();
     $application->add(new InitCommand());
     $command = $application->find('init');
     $commandTester = new CommandTester($command);
     $commandTester->execute(['command' => $command->getName()]);
     foreach ($dirs as $dir) {
         assertThat(is_dir($dir), is(true));
     }
     foreach ($files as $file) {
         assertThat(file_exists($file), is(true));
     }
     $clean();
 }
开发者ID:brtriver,项目名称:dbup,代码行数:32,代码来源:InitCommandTest.php


示例9: testVariableCache

 public function testVariableCache()
 {
     $cache = $this->_cms['cache'];
     $someVar = array('true' => true, 'some' => 'qwerty', 'arr' => array(1, 2, 3), 'obj' => (object) array('q' => 1, 'w' => 2, 'e' => 3));
     $cache->set('some-var', $someVar, 'default', true);
     is($cache->get('some-var'), $someVar);
 }
开发者ID:JBZoo,项目名称:CrossCMS,代码行数:7,代码来源:CacheTest.php


示例10: replace_PhraseWithTwoWordsAndAllWordsExistingInDictionary_ReturnsTranslation

 /**
  * @test
  */
 public function replace_PhraseWithTwoWordsAndAllWordsExistingInDictionary_ReturnsTranslation()
 {
     $dictionary = [$word = 'snow' => 'white watering', $wordB = 'sun' => 'hot lighting'];
     $this->replacer->setDictionary($dictionary);
     $result = $this->replacer->replace("It's \${$word}\$ outside and \${$wordB}\$");
     assertThat($result, is(equalTo("It's white watering outside and hot lighting")));
 }
开发者ID:cmygeHm,项目名称:KataLessons,代码行数:10,代码来源:DictionaryReplacerTest.php


示例11: testCode500

 public function testCode500()
 {
     $uniq = uniqid();
     $result = $this->helper->request(__METHOD__, array('test-response-set500' => $uniq));
     isContain($uniq, $result->body);
     is(500, $result->code);
 }
开发者ID:JBZoo,项目名称:CrossCMS,代码行数:7,代码来源:ResponseTest.php


示例12: testRemoveCirclesDeg

 public function testRemoveCirclesDeg()
 {
     is('180 d', $this->val('540 d')->removeCircles()->dump(false));
     is('-1 r', $this->val('-5 r')->removeCircles()->dump(false));
     is('0 g', $this->val('1600 g')->removeCircles()->dump(false));
     is('-0.55 t', $this->val('-5.55 t')->removeCircles()->dump(false));
 }
开发者ID:jbzoo,项目名称:simpletypes,代码行数:7,代码来源:degreeTypeTest.php


示例13: testResult

 public function testResult()
 {
     $result = new Result();
     ok($result);
     $result->success('Success Tset');
     is('success', $result->type);
     is(true, $result->isSuccess());
     ok($result->message);
     ok($result->error('Error Tset'));
     is('error', $result->type);
     is(true, $result->isError());
     ok($result->getMessage());
     ok($result->valid('Valid Tset'));
     is('valid', $result->type);
     is(true, $result->isValidation());
     ok($result->invalid('Valid Tset'));
     is('invalid', $result->type);
     is(true, $result->isValidation());
     ok($result->completion('country', 'list', ['tw', 'jp', 'us']));
     is('completion', $result->type);
     is(true, $result->isCompletion());
     ok($result->desc('description'));
     ok($result->debug('debug'));
     ok($result->toArray());
     ok($result->__toString());
 }
开发者ID:corneltek,项目名称:actionkit,代码行数:26,代码来源:ResultTest.php


示例14: testExplodeAssocWithCustomGlueArgumentsReturnsCorrectArrayValue

 public function testExplodeAssocWithCustomGlueArgumentsReturnsCorrectArrayValue()
 {
     $string = 'some_key:dummyvalue;another_key:anothervalue';
     $expectedArray = ['some_key' => 'dummyvalue', 'another_key' => 'anothervalue'];
     $explodedValue = explode_assoc($string, ':', ';');
     assertThat($explodedValue, is(equalTo($expectedArray)));
 }
开发者ID:estebanmatias92,项目名称:pull-automatically-galleries,代码行数:7,代码来源:helpersTest.php


示例15: testEvaluateFunction

 public function testEvaluateFunction()
 {
     is(1, LazyRecord\Utils::evaluate(1));
     is(2, LazyRecord\Utils::evaluate(function () {
         return 2;
     }));
 }
开发者ID:nilportugues-php-tools,项目名称:LazyRecord,代码行数:7,代码来源:UtilsTest.php


示例16: testAddReferenceTexts

 function testAddReferenceTexts()
 {
     $highlight1 = new Highlight(5, 8, 'type1', 2, 6, $this->license1->getId());
     $highlights = array($highlight1);
     $this->highlight->addReferenceTexts($highlights);
     assertThat($highlight1->getInfoText(), is("10"));
 }
开发者ID:DanielDobre,项目名称:fossology,代码行数:7,代码来源:HighlightProcessorTest.php


示例17: testexpand

 public function testexpand()
 {
     $paths = FileUtils::expand_path('/path/{to,to2,to3,foo,bar}/end');
     is(count($paths), 5);
     $paths = FileUtils::expand_path('/path/foo/end');
     is(count($paths), 1);
 }
开发者ID:corneltek,项目名称:phifty,代码行数:7,代码来源:FileUtilsTest.php


示例18: cmpr

function cmpr()
{
    $s = array("", "123", "123q", "q123", "-456", "-456.7", "7.80", "9000000000", "9e10");
    $i = array(0, 123, -456, 7.8, 90000000000);
    for ($ji = 0; $ji < 5; ++$ji) {
        cs($i[$ji]);
    }
    for ($js = 0; $js < 9; ++$js) {
        ci($s[$js]);
    }
    for ($ji = 0; $ji < 5; ++$ji) {
        for ($js = 0; $js < 9; ++$js) {
            is($i[$ji], $s[$js]);
        }
    }
    print "----------\n0 == 'q123'\n";
    var_dump(0 == "q123");
    print "----------\n123 == '123q'\n";
    var_dump(123 == "123q");
    print "----------\n123 == '123.0'\n";
    var_dump(123 == "123.0");
    print "----------\n90000000000 == '9e10'\n";
    var_dump(9000000000 == "9e10");
    print "----------\n0 == '-456'\n";
    var_dump(0 == "-456");
}
开发者ID:badlamer,项目名称:hhvm,代码行数:26,代码来源:eq_int_str.php


示例19: testSetHostToCreateNewGallery

 public function testSetHostToCreateNewGallery()
 {
     $model = new RemoteModelStub();
     $model->setHost('Flickr');
     $gallery = $model->newModel();
     assertThat($gallery, is(anInstanceOf('PullAutomaticallyGalleries\\RemoteApi\\RemoteApiModelInterface')));
 }
开发者ID:estebanmatias92,项目名称:pull-automatically-galleries,代码行数:7,代码来源:BaseRemoteModelTest.php


示例20: Converter2

 /**
  * @test
  */
 public function Converter2()
 {
     $converter = new MorzeConverter();
     $res = $converter->recursiveParse('. .-.. .-.. ---   .-- --- .-. .-.. -..');
     //        $res = $converter->recursiveParse('twig   map asdfasdf');
     assertThat($res, is('elloworld'));
 }
开发者ID:cmygeHm,项目名称:KataLessons,代码行数:10,代码来源:MorzeConverterTest.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP isActionAccessible函数代码示例发布时间:2022-05-15
下一篇:
PHP ir函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap