function getUser($email = '*****@*****.**') { if (DB\countRows('users', "email = ?", array($email)) == 0) { return newUser($email, 'big-joe-' . time(), 'something'); } else { return User::loadFromEmailAddr($email); } }
function testOneEmailAddressMayNotBeAssociatedWithMultipleAccounts() { newUser($email = '*****@*****.**', $username = '******', $password = '******'); $this->get('/account/signup'); $this->submitFormExpectingErrors($this->getForm(), array('username' => 'bigkid', 'email' => '*****@*****.**', 'password1' => 't0pS33cret', 'password2' => 't0pS33cret')); $this->assertContains("//div[contains(., 'already have an account')]"); assertEqual(1, DB\countRows('users', 'email = ?', array('*****@*****.**'))); }
function isValidCode($code) { return DB\countRows('confirmation_codes', 'code = ? AND expires >= NOW()', array($code)) > 0; }