Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * Created by PhpStorm.
- * User: Kevin Van Meerbeek
- * Date: 18/05/2016
- * Time: 18:50
- */
- class Tickets_model_test extends TestCase
- {
- public function setup()
- {
- $this->resetInstance();
- $this->CI->load->model('Login_model');
- $this->model = $this->CI->Login_model;
- }
- /* @Author: Kevin Van Meerbeek
- * Created on: 21/05/2016
- * Last modified: 22/05/2016
- * Test of de data die de user ingeeft uniek is en in de database wordt weggeschreven
- * */
- public function test_loginModelRegistrationInsert()
- {
- $data = [
- 0 => (object)[ 'FIRST_NAME' => 'TEST', 'LAST_NAME' => 'DISPATCHER',
- 'EMAIL' => 'dispatcher@gmail.com', 'PASSWORD' => 'pxl'],
- ];
- $result = $this->model->registration_insert($data);
- for ($i = 0; $i < count($data); $i++) {
- $expectedResult = 'correct';
- $this->assertEquals($result, $expectedResult);
- }
- }
- /* @Author: Kevin Van Meerbeek
- * Created on: 21/05/2016
- * Last modified: 22/05/2016
- * Test of de user succesvol kan inloggen met zijn emailadres en wachtwoord
- * */
- public function test_loginModelLogin()
- {
- $data = [
- 0 => (object)['EMAIL' => 'dispatcher@gmail.com', 'PASSWORD' => '098f6bcd4621d373cade4e832627b4f6' ],
- ];
- $result = $this->model->login($data);
- for ($i = 0; $i < count($data); $i++) {
- $expectedResult = 'UserPassword';
- $this->assertEquals($result, $expectedResult);
- }
- }
- /* @Author: Kevin Van Meerbeek
- * Created on: 21/05/2016
- * Last modified: 22/05/2016
- * Test of de gegevens van de user aan de hand van het emailadres kan worden opgehaald uit de database
- * */
- public function test_loginModelReadUserInformation()
- {
- $expected = [
- 0 => (object)['ACCOUNT_ID' => 1, 'FIRST_NAME' => 'TEST', 'LAST_NAME' => 'DISPATCHER',
- 'EMAIL' => 'dispatcher@gmail.com', 'PASSWORD' => '098f6bcd4621d373cade4e832627b4f6', 'TYPE' => 1, 'BLOCKED' => 0],
- ];
- $result = $this->model->read_user_information('dispatcher@gmail.com');
- for ($i = 0; $i < count($expected); $i++) {
- $this->assertEquals($result[$i]->ACCOUNT_ID, $expected[$i]->ACCOUNT_ID);
- $this->assertEquals($result[$i]->FIRST_NAME, $expected[$i]->FIRST_NAME);
- $this->assertEquals($result[$i]->LAST_NAME, $expected[$i]->LAST_NAME);
- $this->assertEquals($result[$i]->EMAIL, $expected[$i]->EMAIL);
- $this->assertEquals($result[$i]->PASSWORD, $expected[$i]->PASSWORD);
- $this->assertEquals($result[$i]->TYPE, $expected[$i]->TYPE);
- $this->assertEquals($result[$i]->BLOCKED, $expected[$i]->BLOCKED);
- }
- }
- /* @Author: Kevin Van Meerbeek
- * Created on: 21/05/2016
- * Last modified: 22/05/2016
- * Test of de data die de user ingeeft uniek is en in de database wordt weggeschreven
- * */
- public function test_loginModelReadEmailInformation()
- {
- $expected = [
- 0 => (object)['ACCOUNT_ID' => 1, 'FIRST_NAME' => 'TEST', 'LAST_NAME' => 'DISPATCHER',
- 'EMAIL' => 'dispatcher@gmail.com', 'PASSWORD' => '098f6bcd4621d373cade4e832627b4f6', 'TYPE' => 1, 'BLOCKED' => 0],
- ];
- $data = [0 => (object)['EMAIL' => 'dispatcher@gmail.com'],
- ];
- $result = $this->model->read_email_information($data);
- for ($i = 0; $i < count($expected); $i++) {
- $this->assertEquals($result[$i]->ACCOUNT_ID, $expected[$i]->ACCOUNT_ID);
- $this->assertEquals($result[$i]->FIRST_NAME, $expected[$i]->FIRST_NAME);
- $this->assertEquals($result[$i]->LAST_NAME, $expected[$i]->LAST_NAME);
- $this->assertEquals($result[$i]->EMAIL, $expected[$i]->EMAIL);
- $this->assertEquals($result[$i]->PASSWORD, $expected[$i]->PASSWORD);
- $this->assertEquals($result[$i]->TYPE, $expected[$i]->TYPE);
- $this->assertEquals($result[$i]->BLOCKED, $expected[$i]->BLOCKED);
- }
- }
- /* @Author: Kevin Van Meerbeek
- * Created on: 21/05/2016
- * Last modified: 22/05/2016
- * Checkt of het ingegeven emailadres overeen komt met het emailadres uit de database
- * */
- public function test_loginModelCheckEmail()
- {
- $data = [
- 0 => (object)['EMAIL' => 'dispatcher@gmail.com'],
- ];
- $result = $this->model->check_email($data);
- $expectedResult = true;
- $this->assertEquals($result, $expectedResult);
- }
- /* @Author: Kevin Van Meerbeek
- * Created on: 21/05/2016
- * Last modified: 22/05/2016
- * Checkt of het ingegeven wachtwoord overeen komt met het wachtwoord uit de database
- * */
- public function test_loginModelCheckPassword()
- {
- $data = [
- 0 => (object)['PASSWORD' => '098f6bcd4621d373cade4e832627b4f6'],
- ];
- $result = $this->model->check_password($data);
- $expectedResult = true;
- $this->assertEquals($result, $expectedResult);
- }
- /* @Author: Kevin Van Meerbeek
- * Created on: 21/05/2016
- * Last modified: 22/05/2016
- * Test of het wachtwoord reset kan worden aan de hand van het ingegeven emailadres
- * */
- public function test_loginModelResetPassword()
- {
- $expected = [
- 0 => (object)['EMAIL' => 'dispatcher@gmail.com'],
- ];
- $new_pass = 'ab642ce62f55b2ca05b4697f3bd7b53a';
- $this->model->reset_password($expected,$new_pass);
- }
- /* @Author: Kevin Van Meerbeek
- * Created on: 21/05/2016
- * Last modified: 22/05/2016
- * Test of het oude wachtwoord gewijzigd wordt naar het nieuwe ingegeven wachtwoord
- * */
- public function test_loginModelUpdatePassword()
- {
- $data = [
- 0 => (object)['PASSWORD' => '098f6bcd4621d373cade4e832627b4f6'],
- ];
- $new_pass = 'ab642ce62f55b2ca05b4697f3bd7b53a';
- $this->model->reset_password($data,$new_pass);
- }
- /* @Author: Kevin Van Meerbeek
- * Created on: 21/05/2016
- * Last modified: 22/05/2016
- * Test of de gebruiker kan geblokkeerd worden aan de hand van het ingegeven emailadres
- * */
- public function test_loginModelUpdateBlocked()
- {
- $data = [
- 0 => (object)['EMAIL' => 'dispatcher@gmail.com'],
- ];
- $this->model->update_blocked($data);
- }
- /* @Author: Kevin Van Meerbeek
- * Created on: 21/05/2016
- * Last modified: 22/05/2016
- * Test of de gebruiker kan gedeblokkeerd worden aan de hand van het ingegeven emailadres
- * */
- public function test_loginModelUpdateUnBlocked()
- {
- $data = [
- 0 => (object)['EMAIL' => 'dispatcher@gmail.com'],
- ];
- $this->model->update_blocked($data);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement