Skip to content

Email_test

Mathieu Nayrolles edited this page Jan 20, 2016 · 1 revision

Email_test

user,action,time nestor,signup,01 octobre 2015 10:00:00 nestor,lost password,02 octobre 2015 11:00:00 ernest,signup, 03 octobre 2015 11:30:00 anatole,signup, 04 octobre 2015 04:32:00 phillibert,signup, 05 octobre 2015 03:11:00 phillibert,add watch, 05 octobre 2015 03:14:00 phillibert,add m1, 05 octobre 2015 03:16:00 phillibert,add m2, 07 octobre 2015 02:12:00 hippolyte,signup, 08 octobre 2015 01:09:00 hippolyte,add watch, 08 octobre 2015 01:14:00 hippolyte,add m1, 08 octobre 2015 01:18:00 hippolyte,add m2, 10 octobre 2015 03:12:00 raymond,signup, 09 octobre 2015 02:09:00 raymond,add watch, 09 octobre 2015 02:14:00 raymond,add m1, 09 octobre 2015 02:18:00 raymond,add m2, 17 octobre 2015 04:12:00

Emails envoy�s (user,email,time): nestor,signup,01 octobre 2015 10:01:00 nestor,reset-password, 02 octobre 2015 11:01:00 ernest,comeback_100d, 12 janvier 2016 11:45:00 anatole,add_first_watch, 05 octobre 2015 08:40:00 phillibert,check_accuracy, 06 octobre 2015 09:20:00 phillibert,result_email, 07 octobre 2015 04:15:00 phillibert,start_new_measure, 08 novembre 2015 03:03:00 hippolyte,add_another_watch, 13 octobre 2015 02:08:00 raymond,check_accuracy, 10 octobre 2015 10:20:00 raymond,check_accuracy, 17 octobre 2015 03:18:00

  • Class name: Email_test
  • Namespace:
  • Parent class: TestCase

Properties

$users

public mixed $users
  • Visibility: public
  • This property is static.

$measure

public mixed $measure
  • Visibility: public
  • This property is static.

$watch

public mixed $watch
  • Visibility: public
  • This property is static.

$watch2Id

public mixed $watch2Id
  • Visibility: public
  • This property is static.

$baseMeasureId

public mixed $baseMeasureId
  • Visibility: public
  • This property is static.

$watchId

public mixed $watchId
  • Visibility: public
  • This property is static.

$enable_patcher

public mixed $enable_patcher = false
  • Visibility: public
  • This property is static.

$_error_reporting

protected mixed $_error_reporting = -1
  • Visibility: protected

$request

protected \CIPHPUnitTestRequest $request
  • Visibility: protected

$double

protected \CIPHPUnitTestDouble $double
  • Visibility: protected

Methods

setUpBeforeClass

mixed CIPHPUnitTestCase::setUpBeforeClass()
  • Visibility: public
  • This method is static.
  • This method is defined by CIPHPUnitTestCase

setUp

mixed Email_test::setUp()
  • Visibility: public

test_mock

mixed Email_test::test_mock()
  • Visibility: public

test_signup

\pass|\fail Email_test::test_signup()

Nestor SIGN_UP. Mocked id should be resturned

  • Visibility: public

test_lostPassword

\pass|\fail Email_test::test_lostPassword()

Nestor password reset. Mocked id should be resturned

  • Visibility: public

test_AccuracyAndAddFirstWatch

\pass|\fail Email_test::test_AccuracyAndAddFirstWatch()

Nestor adds a watch and a baseMeasure.

24h later, he have reminder for the accuracyMeasure. ernest, anatole, phillibert, hippolyte and raymond have a reminder to add a watch.

  • Visibility: public

test_AccuracyOneWeek

\pass|\fail Email_test::test_AccuracyOneWeek()

1 week after the baseMeasure, nestor have a CHECK_ACCURACY_1_WEEK reminder

  • Visibility: public

test_accuracyEmpty

\pass|\fail Email_test::test_accuracyEmpty()

Nestor do the accuracy measure.

No emails to be sent

  • Visibility: public

test_addSecondWatch

\pass|\fail Email_test::test_addSecondWatch()

Nestor should be reminded once to add a second watch two day after his first watch has been accuratly measured

  • Visibility: public

test_startANewMeasure

\pass|\fail Email_test::test_startANewMeasure()

30 days after the last completed measure, Nestor should have an email to start a new measure.

  • Visibility: public

test_comback

\pass|\fail Email_test::test_comback()

100 days after the last login, a comeback email should be sent

  • Visibility: public

test_addFirstMeasure

mixed Email_test::test_addFirstMeasure()

When user adds a watch. If s/he doesn't add a measure in the first 24h hours -> email

  • Visibility: public

__construct

mixed CIPHPUnitTestCase::__construct(string $name, array $data, string $dataName)

Constructs a test case with the given name.

Arguments

  • $name string
  • $data array
  • $dataName string

request

mixed CIPHPUnitTestCase::request(string $http_method, array|string $argv, array $params, callable $callable)

Request to Controller

Arguments

  • $http_method string - <p>HTTP method</p>
  • $argv array|string - <p>array of controller,method,arg|uri</p>
  • $params array - <p>POST parameters/Query string</p>
  • $callable callable - <p>[deprecated] function to run after controller instantiation. Use $this->request->setCallable() method instead</p>

ajaxRequest

mixed CIPHPUnitTestCase::ajaxRequest(string $http_method, array|string $argv, array $params, callable $callable)

Request to Controller using ajax request

Arguments

  • $http_method string - <p>HTTP method</p>
  • $argv array|string - <p>array of controller,method,arg|uri</p>
  • $params array - <p>POST parameters/Query string</p>
  • $callable callable - <p>[deprecated] function to run after controller instantiation. Use $this->request->setCallable() method instead</p>

getDouble

object CIPHPUnitTestCase::getDouble(string $classname, array $params)

Get Mock Object

$email = $this->getMockBuilder('CI_Email') ->setMethods(['send']) ->getMock(); $email->method('send')->willReturn(TRUE);

will be

$email = $this->getDouble('CI_Email', ['send' => TRUE]);

Arguments

  • $classname string
  • $params array - <p>[method_name => return_value]</p>

verifyInvokedMultipleTimes

mixed CIPHPUnitTestCase::verifyInvokedMultipleTimes(object $mock, string $method, integer $times, array $params)

Verifies that method was called exactly $times times

$loader->expects($this->exactly(2)) ->method('view') ->withConsecutive( ['shop_confirm', $this->anything(), TRUE], ['shop_tmpl_checkout', $this->anything()] );

will be

$this->verifyInvokedMultipleTimes( $loader, 'view', 2, [ ['shop_confirm', $this->anything(), TRUE], ['shop_tmpl_checkout', $this->anything()] ] );

Arguments

  • $mock object - <p>PHPUnit mock object</p>
  • $method string
  • $times integer
  • $params array - <p>arguments</p>

verifyInvoked

mixed CIPHPUnitTestCase::verifyInvoked(object $mock, string $method, array $params)

Verifies a method was invoked at least once

Arguments

  • $mock object - <p>PHPUnit mock object</p>
  • $method string
  • $params array - <p>arguments</p>

verifyInvokedOnce

mixed CIPHPUnitTestCase::verifyInvokedOnce(object $mock, string $method, array $params)

Verifies that method was invoked only once

Arguments

  • $mock object - <p>PHPUnit mock object</p>
  • $method string
  • $params array - <p>arguments</p>

verifyNeverInvoked

mixed CIPHPUnitTestCase::verifyNeverInvoked(object $mock, string $method, array $params)

Verifies that method was not called

Arguments

  • $mock object - <p>PHPUnit mock object</p>
  • $method string
  • $params array - <p>arguments</p>

warningOff

mixed CIPHPUnitTestCase::warningOff()

warningOn

mixed CIPHPUnitTestCase::warningOn()

assertResponseCode

mixed CIPHPUnitTestCase::assertResponseCode(integer $code)

Asserts HTTP response code

Arguments

  • $code integer

assertRedirect

mixed CIPHPUnitTestCase::assertRedirect(string $uri, integer $code)

Set Expected Redirect

This method needs https://github.com/kenjis/ci-phpunit-test/blob/master/application/helpers/MY_url_helper.php.

Arguments

  • $uri string - <p>URI to redirect</p>
  • $code integer - <p>Response Code</p>
Clone this wiki locally