Fix tests according to @dartcafe comments

Signed-off-by: Tortue Torche <tortuetorche@users.noreply.github.com>
This commit is contained in:
Tortue Torche 2019-12-11 09:27:26 +01:00
Родитель c344e17844
Коммит bb507dce72
5 изменённых файлов: 19 добавлений и 18 удалений

Просмотреть файл

@ -164,7 +164,7 @@ class EventController extends Controller {
'fullAnonymous' => boolval($this->event->getFullAnonymous()),
'allowMaybe' => boolval($this->event->getAllowMaybe()),
'voteLimit' => $this->event->getVoteLimit(),
'showResults' => boolval($this->event->getShowResults()),
'showResults' => $this->event->getShowResults(),
'deleted' => boolval($this->event->getDeleted()),
'deleteDate' => $this->event->getDeleteDate()
],

Просмотреть файл

@ -166,7 +166,7 @@ class NotificationController extends Controller {
}
$url = $this->urlGenerator->getAbsoluteURL(
$this->urlGenerator->linkToRoute('polls.page.vote',
array('token' => $poll->getToken()))
array('hash' => $poll->getHash()))
);
$sendUser = $this->userMgr->get($from);

Просмотреть файл

@ -42,8 +42,6 @@ use OCP\AppFramework\Db\Entity;
* @method void setCreated(string $value)
* @method string getAccess()
* @method void setAccess(string $value)
* @method string getToken()
* @method void setToken(string $value)
* @method string getExpire()
* @method void setExpire(string $value)
* @method integer getIsAnonymous()
@ -68,7 +66,7 @@ class Event extends Entity implements JsonSerializable {
protected $owner;
protected $created;
protected $access;
protected $token;
protected $hash;
protected $expire;
protected $isAnonymous;
protected $fullAnonymous;
@ -92,7 +90,7 @@ class Event extends Entity implements JsonSerializable {
'fullAnonymous' => boolval($this->fullAnonymous),
'allowMaybe' => boolval($this->allowMaybe),
'voteLimit' => $this->voteLimit,
'showResults' => boolval($this->showResults),
'showResults' => $this->showResults,
'deleted' => boolval($this->deleted),
'deleteDate' => $this->deleteDate
];

Просмотреть файл

@ -76,7 +76,7 @@ class Version0010Date20190801063812 extends SimpleMigrationStep {
}
if (!$table->hasColumn('delete_date')) {
$table->addColumn('delete_date', Type::DATETIME, [
'notnull' => false
'notnull' => true
]);
}
if (!$table->hasColumn('vote_limit')) {
@ -86,9 +86,9 @@ class Version0010Date20190801063812 extends SimpleMigrationStep {
]);
}
if (!$table->hasColumn('show_results')) {
$table->addColumn('show_results', Type::BOOLEAN, [
$table->addColumn('show_results', Type::STRING, [
'notnull' => true,
'default' => 0
'lenght' => 64
]);
}
@ -160,29 +160,29 @@ class Version0010Date20190801063812 extends SimpleMigrationStep {
while ($row = $result->fetch()) {
if ($row['access'] == 'public') {
// copy the token to a public share
// copy the hash to a public share
$insert
->setParameter('token', $row['token'])
->setParameter('token', $row['hash'])
->setParameter('type', 'public')
->setParameter('poll_id', $row['id'])
->setParameter('user_id', null)
->setParameter('user_email', null);
$insert->execute();
} elseif ($row['access'] == 'hidden') {
// copy the token to a public share
// copy the hash to a public share
// poll stays hidden for registered users
$insert
->setParameter('token', $row['token'])
->setParameter('token', $row['hash'])
->setParameter('type', 'public')
->setParameter('poll_id', $row['id'])
->setParameter('user_id', null)
->setParameter('user_email', null);
$insert->execute();
} elseif ($row['access'] == 'registered') {
// copy the token to a public share
// to keep the token
// copy the hash to a public share
// to keep the hash
$insert
->setParameter('token', $row['token'])
->setParameter('token', $row['hash'])
->setParameter('type', 'public')
->setParameter('poll_id', $row['id'])
->setParameter('user_id', null)

Просмотреть файл

@ -40,8 +40,11 @@ $fm->define('OCA\Polls\Db\Event')->setDefinitions([
$date = new DateTime('tomorrow');
return $date->format('Y-m-d H:i:s');
},
'token' => Faker::regexify('[A-Za-z0-9]{16}'),
'isAnonymous' => 0,
'fullAnonymous' => 0,
'showResults' => true,
'showResults' => 'always',
'delete_date' => function() {
$date = new DateTime('+1 month');
return $date->format('Y-m-d H:i:s');
},
]);