foo = null; $model2 = new TestModel(); $model3 = new TestModel(); $cleanup->cleanup($model); $cleanup->cleanup([$model2]); $cleanup->cleanup($model3, ['text']); $this->assertTrue(isset($model->text)); $this->assertTrue(isset($model->created_at)); $this->assertTrue(isset($model->foo)); $this->assertEquals('', $model->text); $this->assertTrue(isset($model2->text)); $this->assertTrue(isset($model3->text)); $this->assertNull($model3->another_text); $this->assertNull($model3->foo); } /** * Setup the DB */ public function setUp(): void { parent::setUp(); $this->initDatabase(); } }