projet-php/test/RDVRepoTest.php

39 lines
821 B
PHP

<?php
/**
* Created by PhpStorm.
* User: seekdasky
* Date: 08/12/15
* Time: 08:43
*/
class RDVRepoTest extends PHPUnit_Framework_TestCase
{
private $repo;
private $id;
public function __construct()
{
$this->repo = new RDVRepo();
}
public function testConstruct(){
$this->assertTrue(new RDVRepo() instanceof RDVRepo);
}
public function testAdd(){
$id = $this->repo->add(date('Y-m-d H:i:s',time()),30,2,1);
$this->assertNotNull($id);
$this->assertNotFalse($id);
$this->id = $id;
}
public function testGetById(){
$result = $this->repo->getById($this->id);
$this->assertEquals($this->id,$result['id']);
}
public function testDelete(){
$this->assertTrue($this->repo->delete($this->id));
}
}