forked from the-crucible/phpunit-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path12ClassHasAttribute.php
More file actions
38 lines (33 loc) · 821 Bytes
/
12ClassHasAttribute.php
File metadata and controls
38 lines (33 loc) · 821 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
/**
* assertClassHasAttribute(
* string $attributeName,
* string $className[,
* string $message = '']
* )
*
* Reports an error identified by $message if $className::attributeName
* does not exist.
*
* assertClassNotHasAttribute() is the inverse of this assertion
* and takes the same arguments.
*/
class ClassHasAttributeTest extends PHPUnit_Framework_TestCase
{
public function testFailure()
{
/**
* This line will check that Bar class has foo
* instance variable or not.
*
* Note: foo attribute could be of any type: Public, Private or Protected
*/
$this->assertClassHasAttribute('foo', 'Bar');
}
}
class Bar{
public $bar;
#private $foo;
#Uncommenting above line will pass the test
}
?>