public function cmp_ok($exp1, $op, $exp2, $message = '') { switch ($op) { case '==': case '===': assertEquals($exp2, $exp1); break; case '!=': case '!==': assertNotEquals($exp2, $exp1); break; case '>': assertGreaterThan($exp2, $exp1); break; case '<': assertLessThan($exp2, $exp1); break; case '>=': assertGreaterThanOrEqual($exp2, $exp1); break; case '<=': assertLessThanOrEqual($exp2, $exp1); break; } }
public function test_ensure_interpret_doesnt_make_deleted_at() { unset($this->input['deleted_at']); $this->ScaffoldingManager->interpretInputData($this->input); assertEquals(count($this->input['fields']), 4); assertNotEquals($this->input['fields'][2]['name'], 'deleted_at'); }
/** @test */ public function it_allows_a_closure_to_be_used_for_defining_factories() { $comments = TestDummy::times(2)->create('Comment'); assertInstanceOf('Comment', $comments[0]); assertInternalType('string', $comments[0]->body); // Faker should produce a unique value for each generation. assertNotEquals($comments[0]->body, $comments[1]->body); }
/** * @Then /^It should (fail|pass)$/ */ public function assertFailOrPass($success) { if ('fail' === $success) { assertNotEquals(0, $this->return); } else { assertEquals(0, $this->return); } }
public function test_it_copies_page() { $this->RoutesGenerator->shouldReceive('cacheRoutes')->once(); $this->PageVersionManager->shouldReceive('copyPageVersionToAnotherPage')->times(1); $newPage = $this->PageManager->copyPage(1, ['title' => 'Some page title', 'slug' => '/some-page-title', 'http_verb' => 'get', 'view' => 'some.view.path']); assertNotEquals(1, $newPage->id); assertEquals('Some page title', $newPage->title); }
public function test() { $ret = rglob(ROOT_PATH . '/*.php'); assert(1 < count($ret)); assertEquals('autoload.php', basename($ret[0])); $ret = rglob(ROOT_PATH . '/*.php', 0, RGLOB_UP); assert(1 < count($ret)); assertNotEquals('autoload.php', basename($ret[0])); assertEquals('autoload.php', basename($ret[count($ret) - 1])); }
/** * @Then /^there (should|should not) be a user with the username "([^"]*)"$/ */ public function thereShouldBeAUserWithUsername($not, $username) { $not = $not == 'should not'; $users = db_select('users', 'u')->fields('u', array('uid'))->condition('u.name', $username)->execute()->fetchCol(); $users = count($users); if ($not) { assertEquals(0, $users, 'Found user with email address: ' . $email); } else { assertNotEquals(0, $users, 'Failed to find user with email address: ' . $email); } }
public function testCanGenerateUniquePasswordWithSymbols() { $generator = new Generator(); $generator->setNumberOfSymbols(5); $password = $generator->generate(); assertInternalType('string', $password); assertEquals(8, strlen($password)); assertEquals(5, $this->helper->countSymbols($password)); assertEquals(3, $this->helper->countLowerCaseLetters($password)); assertNotEquals($password, $generator->generate()); }
protected function getColumnsWithProperty($property) { $columns = $this->model->getColumnsDefinition(); $columns = array_filter($columns, function ($def) use($property) { if (isset($def[$property]) && $def[$property]) { return true; } return false; }); assertNotEquals(0, count($columns), "No column with property '{$property}'"); return $columns; }
/** * @covers Mobileka\MosaiqHelpers\MosaiqArray::replaceTarget() */ public function test_replaces_target_array() { $ma = new MosaiqArray([]); $ma2 = clone $ma; assertEquals(new MosaiqArray([]), $this->ma->replaceTarget([])); assertEquals([], $this->ma->toArray()); assertNotEquals($ma2, $ma->replaceTarget(['new'])); assertEquals(['new'], $ma->toArray()); }
exec($command, $world->output, $world->return); // Remove formatting & time from output $world->output = trim(implode("\n", $world->output)); }); $steps->Then('/^display last command exit code$/', function ($world) { $world->printDebug("`" . $world->command . "` => " . $world->return); }); $steps->Then('/^display last command output$/', function ($world) { $world->printDebug("`" . $world->command . "`:\n" . $world->output); }); $steps->Then('/^it should (fail|pass) with:$/', function ($world, $success, $data) { if ('fail' === $success) { assertNotEquals(0, $world->return); } else { assertEquals(0, $world->return); } assertEquals((string) $data, $world->output); }); $steps->Then('/^it should (fail|pass)$/', function ($world, $success) { if ('fail' === $success) { assertNotEquals(0, $world->return); } else { assertEquals(0, $world->return); } }); $steps->Then('/^the output should contain$/', function ($world, $text) { assertContains($text, $world->output); }); $steps->Then('/^the output should not contain$/', function ($world, $text) { assertNotContains($text, $world->output); });
/** * Checks, that form field with specified id|name|label|value doesn't have specified value. * * @Then /^the "(?P<field>(?:[^"]|\\")*)" field should not contain "(?P<value>(?:[^"]|\\")*)"$/ */ public function assertFieldNotContains($field, $value) { $field = str_replace('\\"', '"', $field); $node = $this->getSession()->getPage()->findField($field); $value = str_replace('\\"', '"', $value); if (null === $node) { throw new ElementNotFoundException($this->getSession(), 'form field', 'id|name|label|value', $field); } try { assertNotEquals($value, $node->getValue()); } catch (AssertException $e) { $message = sprintf('Form field with id|name|label|value "%s" has "%s" value, but it should not have that value', $field, $node->getValue()); throw new ExpectationException($message, $this->getSession(), $e); } }
require_once getenv("PUBNUB_PATH") . "/manual_tests/parallel/init.php"; echo "# WC Presence and Subscribe at one level..."; $i = 0; $pubnub->subscribe("foo.*,foo.*-pnpres", function ($response) use($pubnub, &$i) { if (array_key_exists("message", $response) && $i == 0) { assertEquals('join', $response['message']['action']); assertEquals($pubnub->getUUID(), $response['message']['uuid']); $i = 1; return true; } elseif (array_key_exists("message", $response) && $i == 1) { assertEquals('join', $response['message']['action']); assertNotEquals($pubnub->getUUID(), $response['message']['uuid']); $pubnub->publish("foo.bar", "stop"); $i = 2; return true; } elseif ($i == 2) { // NOTICE: Sometimes presence event is received before message. Just rerun this test. $i = 3; return true; } elseif (array_key_exists("message", $response) && $i == 3) { assertEquals('leave', $response['message']['action']); assertNotEquals($pubnub->getUUID(), $response['message']['uuid']); echo " OK\n"; return false; } else { echo " Failed\nUnhandled response:\n"; print_r($response); return false; } });
/** * @Then /^I should see a nice loading message$/ */ public function iShouldSeeANiceLoadingMessage() { $message = $this->spin(function () { return trim($this->getSession()->getPage()->find('css', $this->elements['Loading message']['css'])->getHtml()); }, 'Unable to find any loading message'); assertNotEquals('Loading ...', $message, 'The loading message should not equals the default value'); }
/** * @covers Mobileka\MosaicArray\MosaicArray::replaceTarget() */ public function test_replaces_target_array() { $ma = new MosaicArray($this->target); $expect = ['some value']; $result = $ma->replaceTarget($expect)->toArray(); assertEquals($expect, $result); assertNotEquals($this->target, $result); }
default: if (!$test($path)) { throw new Exception("{$path} doesn't exist."); } $action = substr($action, 0, -1); $expected = $world->replace_variables((string) $expected); if ('file' == $type) { $contents = file_get_contents($path); } else { if ('directory' == $type) { $files = glob(rtrim($path, '/') . '/*'); foreach ($files as &$file) { $file = str_replace($path . '/', '', $file); } $contents = implode(PHP_EOL, $files); } } checkString($contents, $expected, $action); } }); $steps->Then('/^an email should (be sent|not be sent)$/', function ($world, $expected) { if ('be sent' === $expected) { assertNotEquals(0, $world->email_sends); } else { if ('not be sent' === $expected) { assertEquals(0, $world->email_sends); } else { throw new Exception('Invalid expectation'); } } });
/** * @Given /^data should not have key "([^"]*)" with value "([^"]*)"$/ */ public function dataShouldNotHaveKeyWithValue($key, $value) { $results = $this->getResponsePayload(); foreach ($results->data as $content) { if (isset($content->{$key})) { $message = sprintf("The value %s exists and should not", $value); assertNotEquals($content->{$key}, $value, $message); } } }
/** * @Then Assert the value :arg1 is not equal :arg2 * @param $actualValue * @param $expectedValue */ public function assertNotEquals($actualValue, $expectedValue) { assertNotEquals($actualValue, $expectedValue, sprintf("Assert the value [%s] is not equal [%s]: ", $actualValue, $expectedValue)); }
/** * @Then /^current player is not the same$/ */ public function currentPlayerIsNotTheSame() { $currentPlayer = $this->game->getCurrentPlayer(); assertNotEquals($currentPlayer, $this->savedPlayer); }
function testGetKey() { $faber = $this->getFaber('foo'); $key1 = $faber->getObjectKey('foo'); $key2 = $faber->getObjectKey('foo', ['foo']); $key3 = $faber->getObjectKey('foo', ['foo', 'bar']); $key4 = $faber->getObjectKey('foo'); $key5 = $faber->getObjectKey('foo', ['foo', 'bar']); assertNotEquals($key1, $key2); assertNotEquals($key1, $key3); assertNotEquals($key2, $key3); assertEquals($key1, $key4); assertEquals($key3, $key5); }
/** * Checks whether previously runned command failed|passed. * * @Then /^it should (fail|pass)$/ * * @param string $success "fail" or "pass" */ public function itShouldFail($success) { if ('fail' === $success) { assertNotEquals(0, $this->return); } else { assertEquals(0, $this->return); } }
/** * @test(expectedFail=true) * @profile(fork) */ public function testAssertNotEqualsFailed() { assertNotEquals(Boolean::valueOf(true), Boolean::valueOf(true)); }