assertNotSame() public static method

Used on objects, it asserts that two variables do not reference the same object.
public static assertNotSame ( mixed $expected, mixed $actual, string $message = '' )
$expected mixed
$actual mixed
$message string
 /**
  * @test
  */
 public function it_should_change_message_type()
 {
     $messageType = new MessageType(MessageType::PONG);
     $socketMessage = $this->socketMessage->changeMessageType($messageType);
     \PHPUnit_Framework_Assert::assertNotSame($this->socketMessage, $socketMessage);
     $this->assertEquals($socketMessage->getMessageType(), $messageType);
     $this->assertSame($socketMessage->getCredentials(), $this->credentials);
     $this->assertEquals($socketMessage->getCorrelationID(), 'correlation');
     $this->assertSame($socketMessage->getData(), $this->protobufMessage);
 }
Example #2
0
/**
 * Asserts that two variables do not have the same type and value.
 * Used on objects, it asserts that two variables do not reference
 * the same object.
 *
 * @param  mixed  $expected
 * @param  mixed  $actual
 * @param  string $message
 */
function assertNotSame($expected, $actual, $message = '')
{
    return PHPUnit_Framework_Assert::assertNotSame($expected, $actual, $message);
}
Example #3
0
 /**
  * Checks whether last response was valid XML.
  * This is done with libxml_get_last_error function.
  *
  * @part xml
  */
 public function seeResponseIsXml()
 {
     libxml_use_internal_errors(true);
     $doc = simplexml_load_string($this->response);
     $num = "";
     $title = "";
     if ($doc === false) {
         $error = libxml_get_last_error();
         $num = $error->code;
         $title = trim($error->message);
         libxml_clear_errors();
     }
     libxml_use_internal_errors(false);
     \PHPUnit_Framework_Assert::assertNotSame(false, $doc, "xml decoding error #{$num} with message \"{$title}\", see http://www.xmlsoft.org/html/libxml-xmlerror.html");
 }
Example #4
0
 public function toHaveLength($length)
 {
     if ($this->negate) {
         a::assertNotSame($length, strlen($this->actual));
     } else {
         a::assertSame($length, strlen($this->actual));
     }
 }
Example #5
0
 public function notSame($expected)
 {
     a::assertNotSame($expected, $this->actual, $this->description);
 }
Example #6
0
 /**
  * Expect that two variables do not have the same type and value.
  * Used on objects, it asserts that two variables do not reference the same object.
  *
  * @param mixed $expected
  * @param string $message
  *
  * @return Expect
  */
 public function notToBe($expected, $message = '')
 {
     Assert::assertNotSame($expected, $this->value, $message);
     return $this;
 }
Example #7
0
 public function isNotTheSameAs($expected)
 {
     Assert::assertNotSame($expected, $this->actual, $this->description);
     return $this;
 }