1 | <?php |
||
5 | class ModelTest extends \PHPUnit\Framework\TestCase |
||
6 | { |
||
7 | public function setUp() |
||
8 | { |
||
9 | $this->model = new Model(); |
||
|
|||
10 | $this->date = date('Y-m-d H:i:s'); |
||
11 | $this->datetime = new \DateTime($this->date); |
||
12 | } |
||
13 | |||
14 | public function testNewEntity() |
||
21 | |||
22 | public function testPopulatedEntity() |
||
39 | |||
40 | /** |
||
41 | * @expectedException Exception |
||
42 | * @expectedExceptionMessage ETNA\Doctrine\Extensions\AutoIncrementID::setId : method not implemented |
||
43 | */ |
||
44 | public function testExceptionOnSetId() |
||
48 | |||
49 | /** |
||
50 | * @expectedException Exception |
||
51 | * @expectedExceptionMessage created_at is not a datetime |
||
52 | */ |
||
53 | public function testExceptionOnGetCreated_at() |
||
59 | |||
60 | /** |
||
61 | * @expectedException Exception |
||
62 | * @expectedExceptionMessage updated_at is not a datetime |
||
63 | */ |
||
64 | public function testExceptionOnGetUpdated_at() |
||
70 | |||
71 | /** |
||
72 | * @expectedException Exception |
||
73 | * @expectedExceptionMessage deleted_at is not a datetime |
||
74 | */ |
||
75 | public function testExceptionOnGetDeleted_at() |
||
81 | |||
82 | /** |
||
83 | * @expectedException Exception |
||
84 | * @expectedExceptionMessage bad deleted_at provided |
||
85 | */ |
||
86 | public function testExceptionOnSetDeleted_at() |
||
90 | |||
91 | /** |
||
92 | * @expectedException Exception |
||
93 | * @expectedExceptionMessage Cannot delete Tests\Model |
||
94 | */ |
||
95 | public function testExceptionOncanNotDeleted() |
||
99 | |||
100 | public function testSetCreatedAt() |
||
105 | |||
106 | public function testSetUpdatedAt() |
||
111 | |||
112 | public function testSetDeletedAt() |
||
120 | |||
121 | public function testSetProperties() |
||
127 | } |
||
128 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: