public function testMagicMethods() { $model = new Model('user', $this->getConfig()); $model->data("first=a&last=z"); $model->username = '******'; $data = ['first' => 'a', 'last' => 'z', 'username' => 'test']; $this->assertEquals($data, $model->data()); $this->assertEquals('a', $model->first); $this->assertTrue(isset($model->last)); unset($model->username); $this->assertTrue(!isset($model->username)); $this->assertEquals(2, $model->count()); $info = $model->getByUsername('test'); $this->assertEquals(1, $info['id']); $id = $model->getFieldByUsername('test', 'id'); $this->assertEquals(1, $id); $id = $model->getFieldByUsername('test', 'id'); $this->assertEquals(1, $id); }