本文整理汇总了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);
}