本文整理汇总了PHP中PHPUnit_Framework_Assert::stringStartsWith方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPUnit_Framework_Assert::stringStartsWith方法的具体用法?PHP PHPUnit_Framework_Assert::stringStartsWith怎么用?PHP PHPUnit_Framework_Assert::stringStartsWith使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPUnit_Framework_Assert
的用法示例。
在下文中一共展示了PHPUnit_Framework_Assert::stringStartsWith方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: stringStartsWith
/**
* Returns a PHPUnit_Framework_Constraint_StringStartsWith matcher object.
*
* @param mixed $prefix
* @return PHPUnit_Framework_Constraint_StringStartsWith
* @since Method available since Release 3.4.0
*/
function stringStartsWith($prefix)
{
return PHPUnit_Framework_Assert::stringStartsWith($prefix);
}
示例2: testConstraintStringStartsNotWith2
/**
* @covers PHPUnit_Framework_Constraint_StringStartsWith
* @covers PHPUnit_Framework_Assert::stringStartsWith
*/
public function testConstraintStringStartsNotWith2()
{
$constraint = PHPUnit_Framework_Assert::logicalNot(PHPUnit_Framework_Assert::stringStartsWith('prefix'));
try {
$constraint->fail('prefixfoo', 'custom message', TRUE);
} catch (PHPUnit_Framework_ExpectationFailedException $e) {
$this->assertEquals("custom message\nFailed asserting that <string:prefixfoo> starts not with \"prefix\".", $e->getDescription());
return;
}
$this->fail();
}
示例3: it_can_be_rendered_automatically_in_views
function it_can_be_rendered_automatically_in_views()
{
$toolbar = $this->addTool('test');
\PHPUnit_Framework_Assert::stringStartsWith('<nav class="navbar navbar-default toolbar', $toolbar);
\PHPUnit_Framework_Assert::stringEndsWith('</nav>', $toolbar);
}
示例4: testConstraintStringStartsNotWith2
/**
* @covers PHPUnit_Framework_Constraint_StringStartsWith
* @covers PHPUnit_Framework_Assert::stringStartsWith
* @covers PHPUnit_Framework_TestFailure::exceptionToString
*/
public function testConstraintStringStartsNotWith2()
{
$constraint = PHPUnit_Framework_Assert::logicalNot(PHPUnit_Framework_Assert::stringStartsWith('prefix'));
try {
$constraint->evaluate('prefixfoo', 'custom message');
} catch (PHPUnit_Framework_ExpectationFailedException $e) {
$this->assertEquals(<<<EOF
custom message
Failed asserting that 'prefixfoo' starts not with "prefix".
EOF
, PHPUnit_Framework_TestFailure::exceptionToString($e));
return;
}
$this->fail();
}
示例5: theResponseIsJson
/**
* @Then the response should be json/JSON
* @Then the response is json/JSON
*/
public function theResponseIsJson()
{
Assert::assertThat(static::$response->headers->get('Content-Type'), Assert::logicalOr(Assert::stringStartsWith('application/json'), Assert::stringStartsWith('text/javascript')));
Assert::assertJson($this->getResponseContent());
}