本文整理匯總了PHP中SimpleTestCompatibility::isReference方法的典型用法代碼示例。如果您正苦於以下問題:PHP SimpleTestCompatibility::isReference方法的具體用法?PHP SimpleTestCompatibility::isReference怎麽用?PHP SimpleTestCompatibility::isReference使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類SimpleTestCompatibility
的用法示例。
在下文中一共展示了SimpleTestCompatibility::isReference方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testObjectReferences
public function testObjectReferences()
{
$object = new ComparisonClass();
$object_reference = $object;
$object_copy = new ComparisonClass();
$object_assignment = $object;
$this->assertTrue(SimpleTestCompatibility::isReference($object, $object));
$this->assertTrue(SimpleTestCompatibility::isReference($object, $object_reference));
$this->assertFalse(SimpleTestCompatibility::isReference($object, $object_copy));
$this->assertTrue(SimpleTestCompatibility::isReference($object, $object_assignment));
}
示例2: testObjectReferences
function testObjectReferences()
{
$object = new ComparisonClass();
$object_reference =& $object;
$object_copy = new ComparisonClass();
$object_assignment = $object;
$this->assertTrue(SimpleTestCompatibility::isReference($object, $object));
$this->assertTrue(SimpleTestCompatibility::isReference($object, $object_reference));
$this->assertFalse(SimpleTestCompatibility::isReference($object, $object_copy));
if (version_compare(phpversion(), '5', '>=')) {
$this->assertTrue(SimpleTestCompatibility::isReference($object, $object_assignment));
} else {
$this->assertFalse(SimpleTestCompatibility::isReference($object, $object_assignment));
}
}
示例3: testAddTwice
function testAddTwice()
{
$parent = $this->generateSection(0);
$section1 = $this->generateSection(0);
$fakeSection1 = $this->generateSection(0);
//will generate with the
//same data as the section above
$this->assertFalse(SimpleTestCompatibility::isReference($section1, $fakeSection1));
//add once
$parent->add($section1);
$resultSection =& $parent->get($section1->getId());
$this->assertNotNull($resultSection);
$this->assertSectionsEqual($section1, $resultSection);
//add again
$result = $parent->add($section1);
$this->assertTrue(PEAR::isError($result));
$this->assertNotNull($parent->get($section1->getId()));
//add other
$result = $parent->add($fakeSection1);
$this->assertTrue(PEAR::isError($result));
}
示例4: assertNotSame
/**
* In PHP5 the identity test tests for the same
* object. This is a reference test in PHP4.
* @param $first First object handle.
* @param $second Hopefully a different handle.
* @param $message Message to display.
* @public
*/
function assertNotSame(&$first, &$second, $message = "%s")
{
$dumper =& new SimpleDumper();
$message = sprintf($message, "[" . $dumper->describeValue($first) . "] and [" . $dumper->describeValue($second) . "] should not be the same object");
return $this->assert(new falseExpectation(), SimpleTestCompatibility::isReference($first, $second), $message);
}
示例5: test
/**
* Tests the expectation. True if it exactly
* references the held value.
* @param mixed $compare Comparison reference.
* @return boolean True if correct.
* @access public
*/
function test(&$compare)
{
return SimpleTestCompatibility::isReference($this->_value, $compare);
}
示例6: assertNotSame
/**
* Inverted identity test.
*
* @param $first First object handle.
* @param $second Hopefully a different handle.
* @param $message Message to display.
*/
public function assertNotSame($first, $second, $message = '%s')
{
$dumper = new SimpleDumper();
$message = sprintf($message, '[' . $dumper->describeValue($first) . '] and [' . $dumper->describeValue($second) . '] should not be the same object');
return $this->assert(new falseExpectation(), SimpleTestCompatibility::isReference($first, $second), $message);
}
示例7: be_copy_of
function be_copy_of(&$first, &$second, $message = '%s')
{
$dumper = new SimpleDumper();
$message = sprintf($message, "[" . $dumper->describeValue($first) . "] and [" . $dumper->describeValue($second) . "] should not be the same object");
return $this->runtime->assert(new FaseExpectation(), SimpleTestCompatibility::isReference($first, $second), $message);
}