| 1 |
lars |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
|
|
|
4 |
class SelfMemberReferenceUnitTestExample
|
|
|
5 |
{
|
|
|
6 |
|
|
|
7 |
|
|
|
8 |
private $testCount = 0;
|
|
|
9 |
|
|
|
10 |
|
|
|
11 |
private $testResults = array();
|
|
|
12 |
|
|
|
13 |
|
|
|
14 |
public function SelfMemberReferenceUnitTestExample()
|
|
|
15 |
{
|
|
|
16 |
$testResults =& $this->testResults;
|
|
|
17 |
|
|
|
18 |
|
|
|
19 |
// Correct call to self.
|
|
|
20 |
$testResults[] = self::selfMemberReferenceUnitTestFunction();
|
|
|
21 |
$testResults[] = parent::selfMemberReferenceUnitTestFunction();
|
|
|
22 |
|
|
|
23 |
// Incorrect case.
|
|
|
24 |
$testResults[] = Self::selfMemberReferenceUnitTestFunction();
|
|
|
25 |
$testResults[] = SELF::selfMemberReferenceUnitTestFunction();
|
|
|
26 |
$testResults[] = SelfMemberReferenceUnitTestExample::selfMemberReferenceUnitTestFunction();
|
|
|
27 |
|
|
|
28 |
|
|
|
29 |
// Incorrect spacing.
|
|
|
30 |
$testResults[] = self ::selfMemberReferenceUnitTestFunction();
|
|
|
31 |
$testResults[] = self:: selfMemberReferenceUnitTestFunction();
|
|
|
32 |
$testResults[] = self :: selfMemberReferenceUnitTestFunction();
|
|
|
33 |
|
|
|
34 |
}
|
|
|
35 |
|
|
|
36 |
|
|
|
37 |
function selfMemberReferenceUnitTestFunction()
|
|
|
38 |
{
|
|
|
39 |
$this->testCount = $this->testCount + 1;
|
|
|
40 |
return $this->testCount;
|
|
|
41 |
|
|
|
42 |
}
|
|
|
43 |
|
|
|
44 |
|
|
|
45 |
}
|
|
|
46 |
|
|
|
47 |
|
|
|
48 |
?>
|