Chris@0: config('user.settings')->set('notify.' . $op, TRUE)->save(); Chris@0: $return = _user_mail_notify($op, $this->createUser()); Chris@0: $this->assertTrue($return, '_user_mail_notify() returns TRUE.'); Chris@0: foreach ($mail_keys as $key) { Chris@0: $filter = ['key' => $key]; Chris@0: $this->assertNotEmpty($this->getMails($filter), "Mails with $key exists."); Chris@0: } Chris@0: $this->assertCount(count($mail_keys), $this->getMails(), 'The expected number of emails sent.'); Chris@0: } Chris@0: Chris@0: /** Chris@0: * Tests mails are not sent when notify.$op is FALSE. Chris@0: * Chris@0: * @param string $op Chris@0: * The operation being performed on the account. Chris@0: * @param array $mail_keys Chris@0: * The mail keys to test for. Ignored by this test because we assert that no Chris@0: * mails at all are sent. Chris@0: * Chris@0: * @dataProvider userMailsProvider Chris@0: */ Chris@0: public function testUserMailsNotSent($op, array $mail_keys) { Chris@0: $this->config('user.settings')->set('notify.' . $op, FALSE)->save(); Chris@0: $return = _user_mail_notify($op, $this->createUser()); Chris@0: $this->assertFalse($return, '_user_mail_notify() returns FALSE.'); Chris@0: $this->assertEmpty($this->getMails(), 'No emails sent by _user_mail_notify().'); Chris@0: } Chris@0: Chris@0: }