本文整理汇总了PHP中PHPUnit_Framework_Assert::assertGreaterThanOrEqual方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPUnit_Framework_Assert::assertGreaterThanOrEqual方法的具体用法?PHP PHPUnit_Framework_Assert::assertGreaterThanOrEqual怎么用?PHP PHPUnit_Framework_Assert::assertGreaterThanOrEqual使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPUnit_Framework_Assert
的用法示例。
在下文中一共展示了PHPUnit_Framework_Assert::assertGreaterThanOrEqual方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: it_can_be_added_to_faker_as_a_provider_and_used
/** @test */
public function it_can_be_added_to_faker_as_a_provider_and_used()
{
$faker = Factory::create();
$faker->addProvider(new BuzzwordJobProvider($faker));
$jobTitle = $faker->jobTitle();
$jobTitleWords = explode(' ', $jobTitle);
Assert::assertGreaterThanOrEqual(3, $jobTitleWords);
}
示例2: toBeGreaterThanOrEqualTo
public function toBeGreaterThanOrEqualTo($expected)
{
if ($this->negate) {
a::assertLessThan($expected, $this->actual);
} else {
a::assertGreaterThanOrEqual($expected, $this->actual);
}
}
示例3: testGenerateHeaders
public function testGenerateHeaders()
{
$generator = new Generator();
$headers = $generator->addSignatureToHeadersArray('GET', 'http://somesite.com/sample/url', ['foo' => 'bar'], 'myapi123', 'mysecret456');
$nonce = $headers['X-TOKENLY-AUTH-NONCE'];
PHPUnit::assertGreaterThanOrEqual(time(), $nonce);
PHPUnit::assertEquals('myapi123', $headers['X-TOKENLY-AUTH-API-TOKEN']);
$expected_signature = $this->expectedSignature($nonce);
PHPUnit::assertEquals($expected_signature, $headers['X-TOKENLY-AUTH-SIGNATURE']);
// with GET params
$headers = $generator->addSignatureToHeadersArray('GET', 'http://somesite.com/sample/url?foo=bar', null, 'myapi123', 'mysecret456');
$nonce = $headers['X-TOKENLY-AUTH-NONCE'];
PHPUnit::assertGreaterThanOrEqual(time(), $nonce);
PHPUnit::assertEquals('myapi123', $headers['X-TOKENLY-AUTH-API-TOKEN']);
$expected_signature = $this->expectedSignature($nonce);
PHPUnit::assertEquals($expected_signature, $headers['X-TOKENLY-AUTH-SIGNATURE']);
}
示例4: foreach
/**
* @When /^el usuario "([^"]*)" tiene una sanción por la taquilla "([^"]*)" de todo el curso$/
*/
public function elUsuarioTieneUnaSanciónPorLaTaquillaDeTodoElCurso($username, $code)
{
/** @var User $user */
$user = $this->getRepository('user')->findOneBy(['username' => $username]);
if (!$user) {
throw new \Exception('User not found: ' . $username);
}
\PHPUnit_Framework_Assert::assertTrue($user->getIsPenalized());
$this->getEntityManager()->refresh($user);
$penalties = $user->getPenalties();
$endSeason = TimePenalty::getEndSeasonPenalty();
foreach ($penalties as $penalty) {
if ($penalty instanceof TimePenalty) {
if ($penalty->getRental()->getLocker()->getCode() == $code) {
\PHPUnit_Framework_Assert::assertGreaterThanOrEqual($endSeason, $penalty->getEndAt());
return true;
}
}
}
throw new \Exception('TimePenalty not found.');
}
示例5: testAuthenticationHeaders
public function testAuthenticationHeaders()
{
$generator = new Generator();
$api = Phake::partialMock('Tokenly\\APIClient\\TokenlyAPI', 'https://127.0.0.1/api/v1', $generator, 'MY_CLIENT_ID', 'MY_CLIENT_SECRET');
$headers_generated = [];
Phake::when($api)->callRequest(Phake::anyParameters())->thenReturnCallback(function ($url, $headers, $body, $method, $options) use(&$headers_generated) {
$response = new Requests_Response();
$response->body = json_encode(['sample' => 'output']);
$headers_generated = $headers;
return $response;
});
$result = $api->call('GET', 'method/one', ['foo' => 'bar']);
PHPUnit::assertEquals(['sample' => 'output'], $result);
// check headers
PHPUnit::assertNotEmpty($headers_generated);
$nonce = $headers_generated['X-TOKENLY-AUTH-NONCE'];
PHPUnit::assertGreaterThanOrEqual(time(), $nonce);
PHPUnit::assertEquals('MY_CLIENT_ID', $headers_generated['X-TOKENLY-AUTH-API-TOKEN']);
$expected_signature = $this->expectedSignature($nonce);
PHPUnit::assertEquals($expected_signature, $headers_generated['X-TOKENLY-AUTH-SIGNATURE']);
}
示例6: iShouldSeeATableContainingTheFollowingRows
/**
* @Then /^I should see a table containing the following rows:$/
*/
public function iShouldSeeATableContainingTheFollowingRows(TableNode $table)
{
$output = $this->getOutputAsArray();
$expectedRows = $table->getRows();
$foundRows = 0;
foreach ($expectedRows as $row) {
foreach ($output as $line) {
$foundCells = 0;
foreach ($row as $cell) {
if (!$cell) {
$foundCells++;
continue;
}
if (false !== strpos($line, $cell)) {
$foundCells++;
}
}
if ($foundCells == count($row)) {
$foundRows++;
}
}
}
\PHPUnit_Framework_Assert::assertGreaterThanOrEqual(count($expectedRows), $foundRows, $this->getOutput());
}
示例7: testCreatePost
public function testCreatePost()
{
//fwrite(STDOUT, __METHOD__ . "\n");
PHPUnit_Framework_Assert::assertNotNull(self::$postPDO);
$newPostItem = array('id' => null, 'forumId' => self::$forumId, 'userId' => SELF::USER_ID, 'title' => 'TestPost.0', 'content' => 'This is a test post item.0', 'contentType' => 'text/plain');
$forumPostItemId = self::$postPDO->createForumPostEntry($newPostItem);
PHPUnit_Framework_Assert::assertNotNull($forumPostItemId);
PHPUnit_Framework_Assert::assertGreaterThanOrEqual(0, $forumPostItemId);
$newPostItem['id'] = $forumPostItemId;
return $newPostItem;
}
示例8: theResponseShouldContainJson
/**
* Checks that response body contains JSON from PyString.
*
* Do not check that the response body /only/ contains the JSON from PyString,
*
* @param PyStringNode $jsonString
*
* @throws \RuntimeException
*
* @Then /^(?:the )?response should contain json:$/
*/
public function theResponseShouldContainJson(PyStringNode $jsonString)
{
$etalon = json_decode($this->replacePlaceHolder($jsonString->getRaw()), true);
$actual = json_decode($this->getResponse()->getBody(), true);
if (null === $etalon) {
throw new \RuntimeException("Can not convert etalon to json:\n" . $this->replacePlaceHolder($jsonString->getRaw()));
}
Assertions::assertGreaterThanOrEqual(count($etalon), count($actual));
foreach ($etalon as $key => $needle) {
if (is_array($needle)) {
foreach ($needle as $k => $v) {
if (is_array($v) && in_array('id', array_keys($v))) {
continue 2;
}
}
}
if (in_array($key, ['id', 'updated_at', 'created_at', 'start_at', 'end_at', 'slug'])) {
continue;
}
Assertions::assertArrayHasKey($key, $actual);
Assertions::assertEquals($etalon[$key], $actual[$key]);
}
}
示例9: theResponseShouldContainJson
/**
* Checks that response body contains JSON from PyString.
*
* Do not check that the response body /only/ contains the JSON from PyString,
*
* @param PyStringNode $jsonString
*
* @throws \RuntimeException
*
* @Then /^(?:the )?response should contain json:$/
*/
public function theResponseShouldContainJson(PyStringNode $jsonString)
{
$etalon = json_decode($this->replacePlaceHolder($jsonString->getRaw()), true);
$actual = $this->response->json();
if (null === $etalon) {
throw new \RuntimeException("Can not convert etalon to json:\n" . $this->replacePlaceHolder($jsonString->getRaw()));
}
Assertions::assertGreaterThanOrEqual(count($etalon), count($actual));
foreach ($etalon as $key => $needle) {
Assertions::assertArrayHasKey($key, $actual);
Assertions::assertEquals($etalon[$key], $actual[$key]);
}
}
示例10: greaterOrEquals
public function greaterOrEquals($expected)
{
a::assertGreaterThanOrEqual($expected, $this->actual, $this->description);
}
示例11: assertGreaterOrEquals
/**
* @param $expected
* @param $actual
* @param $description
*/
protected function assertGreaterOrEquals($expected, $actual, $description)
{
\PHPUnit_Framework_Assert::assertGreaterThanOrEqual($expected, $actual, $description);
}
示例12: theResultContainsAtLeastItems
/**
* @Then the api/API result should contain at least :count item(s)
* @Then the api/API result contains at least :count item(s)
*/
public function theResultContainsAtLeastItems($count)
{
$result = $this->getApiResult();
Assert::assertContainsOnly('array', $result);
Assert::assertGreaterThanOrEqual($count, count($result));
}
示例13: isGreaterOrEqualTo
public function isGreaterOrEqualTo($expected)
{
Assert::assertGreaterThanOrEqual($expected, $this->actual, $this->description);
return $this;
}
示例14: theResponseShouldContainJson
/**
* @Then the response should contain json:
*/
public function theResponseShouldContainJson(PyStringNode $jsonString)
{
$etalon = json_decode($jsonString->getRaw(), true);
$a = $this->getSession()->getPage();
// $b = $this->getSession()->getPage()->getHtml();
$c = $this->getSession()->getPage()->getContent();
$actual = json_decode($this->getMink()->getSession()->getPage()->getContent(), true);
if (null === $etalon) {
throw new \RuntimeException("Can not convert etalon to json:\n");
}
Assertions::assertGreaterThanOrEqual(count($etalon), count($actual));
foreach ($etalon as $key => $needle) {
Assertions::assertArrayHasKey($key, $actual);
$e = $etalon[$key];
$g = $actual[$key];
Assertions::assertEquals($etalon[$key], $actual[$key]);
}
}
示例15: theResponseShouldContainJson
/**
* Checks that response body contains JSON from PyString.
*
* Do not check that the response body /only/ contains the JSON from PyString,
*
* @param PyStringNode $jsonString
*
* @throws \RuntimeException
*
* @Then /^(?:the )?response should contain json:$/
*/
public function theResponseShouldContainJson(PyStringNode $jsonString)
{
$expected = json_decode($this->replacePlaceHolder($jsonString->getRaw()), true);
$actual = json_decode($this->response->getBody(), true);
if (null === $expected) {
throw new \RuntimeException("Can not convert expected to json:\n" . $this->replacePlaceHolder($jsonString->getRaw()));
}
Assertions::assertGreaterThanOrEqual(count($expected), count($actual));
$this->assertContains($expected, $actual);
}