Minor - using session as object in test

pull/3034/head
Sébastien Ducoulombier 6 years ago
parent 34211fe64c
commit bcb3580c6b
  1. 17
      main/webservices/api/tests/TestCreateSessionFromModel.php

@ -47,14 +47,19 @@ class TestCreateSessionFromModel extends V2TestCase
);
// assert the session was created and given the returned session id
$session = (new SessionManager)->fetch($newSessionId);
$this->assertIsArray($session);
$entityManager = Database::getManager();
$repository = $entityManager->getRepository('ChamiloCoreBundle:Session');
$newSession = $repository->find($newSessionId);
$this->assertIsObject($newSession);
// assert the new session got the right data
$this->assertSame($name, $session['name']);
// FIXME time shift (one or two hours back)
// $this->assertSame($startDate, $session['display_start_date']);
// $this->assertSame($endDate, $session['display_end_date']);
$this->assertSame($name, $newSession->getName());
// FIXME account for UTC / local timezone shift
// $this->assertSame($endDate, $newSession->getDisplayEndDate());
// $this->assertSame($startDate, $newSession->getAccessStartDate());
// $this->assertSame($endDate, $newSession->getAccessEndDate());
// $this->assertSame($startDate, $newSession->getCoachAccessStartDate());
// $this->assertSame($endDate, $newSession->getCoachAccessEndDate());
// clean up
SessionManager::delete($modelSessionId);

Loading…
Cancel
Save