Skip to content

Commit

Permalink
Add key value array for mock user to ease tests' understanding #35
Browse files Browse the repository at this point in the history
  • Loading branch information
MathieuNls committed Nov 23, 2015
1 parent 2435cae commit 0873072
Showing 1 changed file with 23 additions and 5 deletions.
28 changes: 23 additions & 5 deletions application/tests/models/Email_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,22 +34,40 @@ public static function setUpBeforeClass() {
$CI->User->insert($data);

$data['email'] = '[email protected]';
// + 2 days and 1 hour
$data['registerDate'] = time() + (2*24*60*60) + 3600;
$data['lastLogin'] = $data['registerDate'];
$CI->User->insert($data);

$data['email'] = '[email protected]';
$data['registerDate'] = time() + (3*24*60*60) + 3600;
$data['lastLogin'] = $data['registerDate'];
$CI->User->insert($data);

$data['email'] = '[email protected]';
$data['registerDate'] = time() + (4*24*60*60) + 3600;
$data['lastLogin'] = $data['registerDate'];
$CI->User->insert($data);

$data['email'] = '[email protected]';
$data['registerDate'] = time() + (5*24*60*60) + 3600;
$data['lastLogin'] = $data['registerDate'];
$CI->User->insert($data);

$data['email'] = '[email protected]';
$data['registerDate'] = time() + (6*24*60*60) + 3600;
$data['lastLogin'] = $data['registerDate'];
$CI->User->insert($data);

$tmp = $CI->User->select()->find_all();

self::$users = $CI->User->select()->find_all();

self::$users['nestor'] = $tmp[0];
self::$users['ernest'] = $tmp[1];
self::$users['anatole'] = $tmp[2];
self::$users['phillibert'] = $tmp[3];
self::$users['hippolyte'] = $tmp[4];
self::$users['raymond'] = $tmp[5];
}

public function setUp() {
Expand Down Expand Up @@ -96,7 +114,6 @@ public function setUp() {

$this->emailMeasure = new MY_Model('email_measure');
$this->emailWatch = new MY_Model('email_watch');

}

public function test_mock() {
Expand All @@ -111,7 +128,6 @@ public function test_mock() {
);
}


public function test_signup() {

echo 'test_signup';
Expand All @@ -121,7 +137,7 @@ public function test_signup() {
$this->email->updateObserver(
'TEST',
SIGN_UP,
self::$users[0])[0]['_id']
self::$users['nestor'])[0]['_id']
);
}

Expand All @@ -136,13 +152,15 @@ public function test_lostPassword(){
$this->email->updateObserver(
'TEST',
RESET_PASSWORD,
array('user' => self::$users[0],
array('user' => self::$users['nestor'],
'token' => 'plop' ))[0]['_id']
);
}





// public function test_addWatch() {

// echo 'test_addWatch';
Expand Down

0 comments on commit 0873072

Please sign in to comment.