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


PHP PHPUnit_Framework_TestCase::assertArrayHasKey方法代码示例

本文整理汇总了PHP中PHPUnit_Framework_TestCase::assertArrayHasKey方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPUnit_Framework_TestCase::assertArrayHasKey方法的具体用法?PHP PHPUnit_Framework_TestCase::assertArrayHasKey怎么用?PHP PHPUnit_Framework_TestCase::assertArrayHasKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PHPUnit_Framework_TestCase的用法示例。


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

示例1: assertArrayHasKey

 public static function assertArrayHasKey($key, $value)
 {
     try {
         return parent::assertArrayHasKey($key, $value);
     } catch (Exception $e) {
         return;
     }
 }
开发者ID:az0ne,项目名称:diaoyu,代码行数:8,代码来源:BaseModelUnitTest.php

示例2: testGetSkypeButton

 /**
  * @dataProvider optionsDataProvider
  * @param string $username
  * @param array $options
  * @param array $expectedOptions
  * @param string $expectedTemplate
  */
 public function testGetSkypeButton($username, $options, $expectedOptions, $expectedTemplate)
 {
     $env = $this->getMockBuilder('\\Twig_Environment')->disableOriginalConstructor()->getMock();
     $env->expects($this->once())->method('render')->with($expectedTemplate, $this->anything())->will($this->returnCallback(function ($template, $options) use($expectedOptions, $username) {
         \PHPUnit_Framework_TestCase::assertArrayHasKey('name', $options['options']);
         \PHPUnit_Framework_TestCase::assertEquals($expectedOptions['name'], $options['options']['name']);
         \PHPUnit_Framework_TestCase::assertArrayHasKey('participants', $options['options']);
         \PHPUnit_Framework_TestCase::assertEquals($expectedOptions['participants'], $options['options']['participants']);
         \PHPUnit_Framework_TestCase::assertArrayHasKey('element', $options['options']);
         \PHPUnit_Framework_TestCase::assertContains('skype_button_' . md5($username), $options['options']['element']);
         return 'BUTTON_CODE';
     }));
     $this->assertEquals('BUTTON_CODE', $this->extension->getSkypeButton($env, $username, $options));
 }
开发者ID:ashutosh-srijan,项目名称:findit_akeneo,代码行数:21,代码来源:SkypeButtonExtensionTest.php

示例3: testInvokesDefaultErrorFormatterWhenDebugIsEnabledAndThrowableCaught

 /**
  * @dataProvider throwables
  */
 public function testInvokesDefaultErrorFormatterWhenDebugIsEnabledAndThrowableCaught($throwable)
 {
     $next = function () use($throwable) {
         throw $throwable;
     };
     $this->renderer->render(ErrorHandler::TEMPLATE_ERROR, Argument::that(function ($argument) use($throwable) {
         TestCase::assertInternalType('array', $argument);
         TestCase::assertArrayHasKey('error', $argument);
         $error = $argument['error'];
         TestCase::assertContains($throwable->getMessage(), $error);
         TestCase::assertContains((string) $throwable->getCode(), $error);
         TestCase::assertContains($throwable->getTraceAsString(), $error);
         return true;
     }))->willReturn('error content');
     $handler = new ErrorHandler($this->renderer->reveal(), true);
     $result = $handler($this->createRequestMock()->reveal(), $this->createResponseMock()->reveal(), $next);
     $this->assertInstanceOf(HtmlResponse::class, $result);
     $this->assertEquals(500, $result->getStatusCode());
     $this->assertEquals('error content', (string) $result->getBody());
 }
开发者ID:vrkansagara,项目名称:mwop.net,代码行数:23,代码来源:ErrorHandlerTest.php

示例4: assertTraitExists

 /**
  * Assert Trait Exists
  *
  * @param string $expected
  * @param Object $object
  * @param string $message
  *
  * @return void
  * @throws
  */
 public function assertTraitExists($expected, $object, $message = '')
 {
     $traits = class_uses($object);
     $message = $message ?: sprintf("Failed asserting not exists Trait instance of interface '%s'.", $expected);
     PHPUnit::assertArrayHasKey($expected, $traits, $message);
 }
开发者ID:naturalweb,项目名称:nwlaravel,代码行数:16,代码来源:WebAssertTrait.php

示例5: log

 /**
  * Logs with an arbitrary level.
  *
  * @param mixed $level
  * @param string $message
  * @param array $context
  * @return null
  */
 public function log($level, $message, array $context = array())
 {
     $this->owner->assertArrayHasKey($this->index, $this->expected);
     $this->owner->assertStringStartsWith($this->expected[$this->index++], $message);
 }
开发者ID:twhiston,项目名称:twlib,代码行数:13,代码来源:DebugLogger.php

示例6: iShouldSeeAJsonField

 /**
  * @Then I should see a JSON field :name
  */
 public function iShouldSeeAJsonField($name)
 {
     $this->iShouldGetJson();
     $data = json_decode($this->getSession()->getPage()->getContent(), true);
     Assertions::assertArrayHasKey($name, $data);
 }
开发者ID:bnowack,项目名称:backbone-php,代码行数:9,代码来源:ProjectContext.php


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