assertNotEquals() public static method

Asserts that two variables are not equal.
public static assertNotEquals ( mixed $expected, mixed $actual, string $message = '', float $delta, integer $maxDepth = 10, boolean $canonicalize = false, boolean $ignoreCase = false )
$expected mixed
$actual mixed
$message string
$delta float
$maxDepth integer
$canonicalize boolean
$ignoreCase boolean
Example #1
0
 public function toEqual($expected)
 {
     if ($this->negate) {
         a::assertNotEquals($expected, $this->actual);
     } else {
         a::assertEquals($expected, $this->actual);
     }
 }
Example #2
0
 public function notEquals($expected)
 {
     if (!$this->isFileExpectation) {
         a::assertNotEquals($expected, $this->actual, $this->description);
     } else {
         a::assertFileNotEquals($expected, $this->actual, $this->description);
     }
 }
 /**
  * Assert that created CMS block non visible on frontend category page
  * (in order to assign block to category: go to category page> Display settings> CMS Block)
  *
  * @param CmsIndex $cmsIndex
  * @param CmsBlock $cmsBlock
  * @param CatalogCategoryView $catalogCategoryView
  * @param FixtureFactory $fixtureFactory
  * @return void
  */
 public function processAssert(CmsIndex $cmsIndex, CmsBlock $cmsBlock, CatalogCategoryView $catalogCategoryView, FixtureFactory $fixtureFactory)
 {
     $category = $fixtureFactory->createByCode('category', ['dataset' => 'default_subcategory', 'data' => ['display_mode' => 'Static block and products', 'landing_page' => $cmsBlock->getTitle()]]);
     $category->persist();
     $cmsIndex->open();
     $cmsIndex->getTopmenu()->selectCategoryByName($category->getName());
     $categoryViewContent = $catalogCategoryView->getViewBlock()->getContent();
     \PHPUnit_Framework_Assert::assertNotEquals($cmsBlock->getContent(), $categoryViewContent, 'Wrong block content on category is displayed.');
 }
 public function testGetPublicKeyFromNode()
 {
     $adapter = $this->getAdapter();
     $publicKey = $this->getPublicKey();
     Assert::assertNotEquals($publicKey, $adapter->getPublicKey());
     $data = new DOMDocument();
     $data->load(__DIR__ . '/_files/basic-doc-signed.xml');
     Assert::assertEquals($publicKey, $adapter->getPublicKey($data));
 }
 /**
  * Assert that shopping cart subtotal not equals with grand total.
  *
  * @return void
  */
 protected function assert()
 {
     $subTotal = $this->checkoutCart->getTotalsBlock()->getSubtotal();
     $grandTotal = $this->checkoutCart->getTotalsBlock()->getGrandTotal();
     if ($this->checkoutCart->getTotalsBlock()->isVisibleShippingPriceBlock()) {
         $shippingPrice = $this->checkoutCart->getTotalsBlock()->getShippingPrice();
         $grandTotal = number_format($grandTotal - $shippingPrice, 2);
     }
     \PHPUnit_Framework_Assert::assertNotEquals($subTotal, $grandTotal, 'Shopping cart subtotal: \'' . $subTotal . '\' equals with grand total: \'' . $grandTotal . '\'');
 }
 public function testPublishAlteredMessage()
 {
     $args = ['Message' => $originalMessage = 'MyOriginalMessage'];
     $this->snsClient->method('__call')->with('publish')->willReturnCallback(function ($name, array $args) use($originalMessage) {
         $params = array_key_exists(0, $args) ? $args[0] : [];
         \PHPUnit_Framework_Assert::assertNotEquals($originalMessage, $params['Message']);
         return new Result();
     });
     $actual = $this->sut->publish($args);
     self::assertInstanceOf(Result::class, $actual);
 }
Example #7
0
 public function testAddUser()
 {
     // insert
     $user_repo = $this->app->make('App\\Repositories\\UserRepository');
     $created_user_model = $user_repo->create($this->app->make('\\UserHelper')->sampleDBVars());
     // load from repo
     $loaded_user_model = $user_repo->findByUuid($created_user_model['uuid']);
     PHPUnit::assertNotEmpty($loaded_user_model);
     PHPUnit::assertEquals($created_user_model['id'], $loaded_user_model['id']);
     PHPUnit::assertEquals('*****@*****.**', $loaded_user_model['email']);
     PHPUnit::assertNotEquals('foo', $loaded_user_model['password']);
 }
Example #8
0
 public function test()
 {
     $object = new UserDefault();
     $type = UserDefault::class;
     $metadata = new ObjectMetadata($object);
     PHPUnit::assertEquals($type, $metadata->getType());
     PHPUnit::assertNotEquals(10, $object->getId());
     $metadata->setValue($object, 'id', 10);
     PHPUnit::assertEquals(10, $object->getId());
     PHPUnit::assertEquals(new \ReflectionClass($object), $metadata->getReflectionClass());
     try {
         $metadata->getProperty('thisPropertyDoesNotExists', true);
         PHPUnit::fail('Must raise an exception');
     } catch (\RuntimeException $ex) {
     }
     $property = $metadata->getProperty('thisPropertyDoesNotExists');
     PHPUnit::assertNull($property);
     $properties = $metadata->getProperties();
     $type = $metadata->getType();
     $object = unserialize(serialize($metadata));
     PHPUnit::assertEquals($properties, $object->getProperties());
     PHPUnit::assertEquals($type, $object->getType());
     PHPUnit::assertEquals($metadata, $object);
 }
 /**
  * Then I (?:don\'t|do not) see "<header>" header with "<value>" value
  */
 public function iDonTSeeResponseHeaderWithValue($header, $value)
 {
     Assertion::assertNotEquals($value, $this->restClient->getResponseHeader($header), "Unexpected '{$header}' header found with '{$this->restClient->getResponseHeader($header)}' value");
 }
 /**
  * Assert that first item in grid is not the same on ascending and descending sorting
  *
  * @param array $sortingResults
  */
 public function processAssert(array $sortingResults)
 {
     foreach ($sortingResults as $columnName => $sortingResult) {
         \PHPUnit_Framework_Assert::assertNotEquals($sortingResult['firstIdAfterFirstSoring'], $sortingResult['firstIdAfterSecondSoring'], sprintf('Sorting for "%s" column have not changed the first item of grid!', $columnName));
     }
 }
Example #11
0
 /**
  * @Then /^the command should fail$/
  */
 public function theCommandShouldFail()
 {
     $exitCode = $this->applicationTester->getLastExitCode();
     \PHPUnit_Framework_Assert::assertNotEquals(0, $exitCode, 'Command exited with code ' . $exitCode);
 }
Example #12
0
 /**
  * Checks the value in field is not equal to value passed.
  * Field is searched by its id|name|label|value or CSS selector.
  *
  * @param $field
  * @param $value
  */
 public function dontSeeInField($field, $value)
 {
     $node = $this->session->getPage()->findField($field);
     if (!$node) {
         return \PHPUnit_Framework_Assert::fail(", field not found");
     }
     \PHPUnit_Framework_Assert::assertNotEquals($this->escape($value), $node->getValue());
 }
Example #13
0
 /**
  * @Then there should be a link titled :title without "nofollow"
  */
 public function thereShouldBeALinkTitledWithoutNoFollow($title)
 {
     $element = $this->assertSession()->elementExists('css', sprintf('a:contains("%s")', $title));
     if (!$element->hasAttribute('rel')) {
         return;
     }
     Assert::assertNotEquals('nofollow', $element->getAttribute('rel'), 'The link\'s "rel" attribute should not match "nofollow"');
 }
 /**
  * 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) {
         \PHPUnit_Framework_Assert::assertNotEquals(0, $this->return);
     } else {
         \PHPUnit_Framework_Assert::assertEquals(0, $this->return);
     }
 }
Example #15
0
 /**
  * Check if a queue/tube does NOT have a given total number of messages
  *
  * ```php
  * <?php
  *     $I->dontSeeQueueHasTotalCount('default', 10);
  * ?>
  * ```
  *
  * @param string $queue    Queue Name
  * @param int    $expected Number of messages expected
  */
 public function dontSeeQueueHasTotalCount($queue, $expected)
 {
     $count = $this->_getMessagesTotalCountOnQueue($queue);
     $this->debug("don't see queue has total count: queue [{$queue}] has [{$count}] messages");
     \PHPUnit_Framework_Assert::assertNotEquals($expected, $count);
 }
Example #16
0
 /**
  * Executes a method and checks that the result is NOT equal to a value.
  * Good for testing values taken from getters.
  *
  * Look for 'seeMethodReturns' for example.
  *
  * @param $object
  * @param $method
  * @param $value
  * @param array $params
  * @deprecated
  */
 public function seeMethodNotReturns($object, $method, $value, $params = array())
 {
     $result = call_user_func_array(array($object, $method), $params);
     \PHPUnit_Framework_Assert::assertNotEquals($value, $result);
 }
 /**
  * Checks whether previously ran command failed|passed.
  *
  * @Then /^it should (fail|pass)$/
  *
  * @param string $success "fail" or "pass"
  */
 public function itShouldFail($success)
 {
     if ('fail' === $success) {
         if (0 === $this->getExitCode()) {
             echo 'Actual output:' . PHP_EOL . PHP_EOL . $this->getOutput();
         }
         PHPUnit_Framework_Assert::assertNotEquals(0, $this->getExitCode());
     } else {
         if (0 !== $this->getExitCode()) {
             echo 'Actual output:' . PHP_EOL . PHP_EOL . $this->getOutput();
         }
         PHPUnit_Framework_Assert::assertEquals(0, $this->getExitCode());
     }
 }
 /**
  * @Then response header :header don't have :value (value)
  */
 public function assertHeaderDontHaveValue($header, $value)
 {
     Assertion::assertNotEquals($value, $this->restDriver->getResponseHeader($header), "Unexpected '{$header}' header found with '{$this->restDriver->getHeader($header)}' value");
 }
Example #19
0
 public function dontSeeCurrentUrlEquals($uri)
 {
     \PHPUnit_Framework_Assert::assertNotEquals($uri, $this->_getCurrentUri());
 }
Example #20
0
 /**
  * Expect that two variables are not equal.
  *
  * @param mixed $expected
  * @param string $message
  * @param float $delta
  * @param int $maxDepth
  * @param bool $canonicalize
  * @param bool $ignoreCase
  *
  * @return Expect
  */
 public function notToEqual($expected, $message = '', $delta = 0.0, $maxDepth = 10, $canonicalize = false, $ignoreCase = false)
 {
     Assert::assertNotEquals($expected, $this->value, $message, $delta, $maxDepth, $canonicalize, $ignoreCase);
     return $this;
 }
 /**
  * Assert that shopping cart subtotal not equals with grand total.
  *
  * @return void
  */
 protected function assert()
 {
     $totals = $this->getTotals();
     \PHPUnit_Framework_Assert::assertNotEquals($totals['subtotal'], $totals['grandTotal'], "Shopping cart subtotal: " . $totals['subtotal'] . " equals with grand total: " . $totals['grandTotal'] . ".\nPrice rule hasn't been applied.");
 }
 /**
  * Assert that you will be not redirected to url from dataset
  *
  * @param CmsIndex $cmsIndex
  * @param CatalogSearchQuery $searchTerm
  * @param BrowserInterface $browser
  * @return void
  */
 public function processAssert(CmsIndex $cmsIndex, BrowserInterface $browser, CatalogSearchQuery $searchTerm)
 {
     $cmsIndex->open()->getSearchBlock()->search($searchTerm->getSynonymFor());
     \PHPUnit_Framework_Assert::assertNotEquals($browser->getUrl(), $searchTerm->getRedirect(), 'Url in the browser corresponds to Url in fixture (redirect has been performed).' . PHP_EOL . 'Search term: "' . $searchTerm->getQueryText() . '"');
 }
Example #23
0
 /**
  * Checks over the given HTTP header and (optionally)
  * its value, asserting that are not there
  *
  * @param $name
  * @param $value
  */
 public function dontSeeHttpHeader($name, $value = null)
 {
     if ($value) {
         \PHPUnit_Framework_Assert::assertNotEquals($this->client->getInternalResponse()->getHeader($name), $value);
     } else {
         \PHPUnit_Framework_Assert::assertNull($this->client->getInternalResponse()->getHeader($name));
     }
 }
Example #24
0
 /**
  * @Given /^user "([^"]*)" does not belong to group "([^"]*)"$/
  * @param string $user
  * @param string $group
  */
 public function userDoesNotBelongToGroup($user, $group)
 {
     $fullUrl = $this->baseUrl . "v2.php/cloud/users/{$user}/groups";
     $client = new Client();
     $options = [];
     if ($this->currentUser === 'admin') {
         $options['auth'] = $this->adminUser;
     }
     $this->response = $client->get($fullUrl, $options);
     $groups = array($group);
     $respondedArray = $this->getArrayOfGroupsResponded($this->response);
     PHPUnit_Framework_Assert::assertNotEquals($groups, $respondedArray, "", 0.0, 10, true);
     PHPUnit_Framework_Assert::assertEquals(200, $this->response->getStatusCode());
 }
Example #25
0
/**
 * Asserts that two variables are not equal.
 *
 * @param  mixed   $expected
 * @param  mixed   $actual
 * @param  string  $message
 * @param  float   $delta
 * @param  integer $maxDepth
 * @param  boolean $canonicalize
 * @param  boolean $ignoreCase
 * @since  Method available since Release 2.3.0
 */
function assertNotEquals($expected, $actual, $message = '', $delta = 0, $maxDepth = 10, $canonicalize = FALSE, $ignoreCase = FALSE)
{
    return PHPUnit_Framework_Assert::assertNotEquals($expected, $actual, $message, $delta, $maxDepth, $canonicalize, $ignoreCase);
}
Example #26
0
 /**
  * Checks that two variables are not equal
  *
  * @param        $expected
  * @param        $actual
  * @param string $message
  */
 protected function assertNotEquals($expected, $actual, $message = '')
 {
     \PHPUnit_Framework_Assert::assertNotEquals($expected, $actual, $message);
 }
 protected function assertCommand($command, $arguments, $info)
 {
     $method = $info['originalMethod'];
     $result = $this->__call($method, $arguments);
     if ($info['isBoolean']) {
         if (!isset($info['negative']) || !$info['negative']) {
             PHPUnit_Framework_Assert::assertTrue($result);
         } else {
             PHPUnit_Framework_Assert::assertFalse($result);
         }
     } else {
         $expected = array_pop($arguments);
         if (strpos($expected, 'exact:') === 0) {
             $expected = substr($expected, strlen('exact:'));
             if (!isset($info['negative']) || !$info['negative']) {
                 PHPUnit_Framework_Assert::assertEquals($expected, $result);
             } else {
                 PHPUnit_Framework_Assert::assertNotEquals($expected, $result);
             }
         } else {
             if (strpos($expected, 'regexp:') === 0) {
                 $expected = substr($expected, strlen('regexp:'));
             } else {
                 if (strpos($expected, 'glob:') === 0) {
                     $expected = substr($expected, strlen('glob:'));
                 }
                 $expected = str_replace(array('*', '?'), array('.*', '.?'), $expected);
             }
             $expected = str_replace('/', '\\/', $expected);
             if (!isset($info['negative']) || !$info['negative']) {
                 PHPUnit_Framework_Assert::assertRegExp('/' . $expected . '/', $result);
             } else {
                 PHPUnit_Framework_Assert::assertNotRegExp('/' . $expected . '/', $result);
             }
         }
     }
 }
Example #28
0
 protected function assertCommand($command, $arguments, $info)
 {
     $method = $info['originalMethod'];
     $requiresTarget = $info['requiresTarget'];
     $result = $this->__call($method, $arguments);
     if ($info['isBoolean']) {
         if (!isset($info['negative']) || !$info['negative']) {
             PHPUnit_Framework_Assert::assertTrue($result, $arguments[count($arguments) - 1]);
         } else {
             PHPUnit_Framework_Assert::assertFalse($result, $arguments[count($arguments) - 1]);
         }
     } else {
         if ($requiresTarget === TRUE) {
             $expected = $arguments[1];
         } else {
             $expected = $arguments[0];
         }
         if (strpos($expected, 'exact:') === 0) {
             $expected = substr($expected, strlen('exact:'));
             if (!isset($info['negative']) || !$info['negative']) {
                 PHPUnit_Framework_Assert::assertEquals($expected, $result);
             } else {
                 PHPUnit_Framework_Assert::assertNotEquals($expected, $result);
             }
         } else {
             $caseInsensitive = FALSE;
             if (strpos($expected, 'regexp:') === 0) {
                 $expected = substr($expected, strlen('regexp:'));
             } else {
                 if (strpos($expected, 'regexpi:') === 0) {
                     $expected = substr($expected, strlen('regexpi:'));
                     $caseInsensitive = TRUE;
                 } else {
                     if (strpos($expected, 'glob:') === 0) {
                         $expected = substr($expected, strlen('glob:'));
                     }
                     $expected = str_replace(array('*', '?'), array('.*', '.?'), $expected);
                 }
             }
             $expected = '/' . str_replace('/', '\\/', $expected) . '/';
             if ($caseInsensitive) {
                 $expected .= 'i';
             }
             if (!isset($info['negative']) || !$info['negative']) {
                 PHPUnit_Framework_Assert::assertRegExp($expected, $result);
             } else {
                 PHPUnit_Framework_Assert::assertNotRegExp($expected, $result);
             }
         }
     }
 }
Example #29
0
 /**
  * @Then I should retrieve a valid download url
  */
 public function isValidDownloadUrl()
 {
     $regex = "/---PACKAGE_URL:(.*)---/";
     \PHPUnit_Framework_Assert::assertRegExp($regex, $this->lastOutput);
     preg_match($regex, $this->lastOutput, $matches);
     $url = $matches[1];
     \PHPUnit_Framework_Assert::assertNotEquals('${package.url}', $url, $this->lastOutput);
 }
 public function testDeleteFromS3()
 {
     $args = ['ReceiptHandle' => $modifiedReceiptHandle = json_encode(['s3_bucket_name' => 'MyBucket', 's3_key' => 'MyKey', 'original_receipt_handle' => 'MyReceiptHandle'])];
     $this->sqsClient->method('__call')->with('deleteMessage')->willReturnCallback(function ($name, array $args) use($modifiedReceiptHandle) {
         $params = array_key_exists(0, $args) ? $args[0] : [];
         \PHPUnit_Framework_Assert::assertNotEquals($modifiedReceiptHandle, $params['ReceiptHandle']);
         return new Result();
     });
     $actual = $this->sut->deleteMessage($args);
     self::assertInstanceOf(Result::class, $actual);
 }