public function testDeletePhoto() { $count1 = PhotoActiveRecord::find()->count(); $photo->userId = 1; $photo->photo = file_get_contents("./web/img/user.png"); $photo->posted = date("Y-m-d H-i-s"); $photo->save(); $controller = new SiteController(); $controller->actionDeletephoto($photo->id); $count2 = PhotoActiveRecord::find()->count(); $this->assert($count1, $count2, 'count before inserting and after deleting are not equals'); /*if($count1 != $count2){ $this->fire('myevent', new TestEvent($this)); }*/ }