Rest tests

This commit is contained in:
Dennis Eichhorn 2016-06-11 19:20:53 +02:00
parent 6718fba177
commit 7bf20b8436
2 changed files with 57 additions and 0 deletions

View File

@ -437,4 +437,27 @@ class Account
$this->createdAt = $created;
}
public function toArray() : array
{
return [
'id' => $this->id,
'name' => [
$this->name1,
$this->name2,
$this->name3,
],
'email' => $this->email,
'login' => $this->login,
'groups' => $this->groups,
'permissions' => $this->permissions,
'type' => $this->type,
'status' => $this->status,
];
}
public function __toString()
{
return json_encode($this->toArray());
}
}

View File

@ -77,6 +77,22 @@ class Group
*/
protected $permissions = [];
/**
* Created at.
*
* @var \DateTime
* @since 1.0.0
*/
protected $createdAt = null;
/**
* Created by.
*
* @var int
* @since 1.0.0
*/
protected $createdBy = 0;
/**
* Constructor.
*
@ -85,6 +101,7 @@ class Group
*/
public function __construct()
{
$this->createdAt = new \DateTime('now');
}
/**
@ -152,4 +169,21 @@ class Group
$this->description = $description;
}
public function toArray() : array
{
return [
'id' => $this->id,
'name' => $this->name,
'description' => $this->description,
'createdBy' => $this->createdBy,
'createdAt' => $this->createdAt->format('Y-m-d H:i:s'),
'permissions' => $this->permissions,
'members' => $this->members,
];
}
public function __toString()
{
return json_encode($this->toArray());
}
}