| @@ 72-89 (lines=18) @@ | ||
| 69 | return true; |
|
| 70 | } |
|
| 71 | ||
| 72 | protected function validEmail($email) |
|
| 73 | { |
|
| 74 | if(filter_var($email) === false) |
|
| 75 | { |
|
| 76 | return false; |
|
| 77 | } |
|
| 78 | $pos = strpos($email, '@'); |
|
| 79 | if($pos === false) |
|
| 80 | { |
|
| 81 | return false; |
|
| 82 | } |
|
| 83 | $domain = substr($email, $pos+1); |
|
| 84 | if(checkdnsrr($domain, 'MX') === false) |
|
| 85 | { |
|
| 86 | return false; |
|
| 87 | } |
|
| 88 | return true; |
|
| 89 | } |
|
| 90 | ||
| 91 | public function createUser($request, $response, $args) |
|
| 92 | { |
|
| @@ 4-21 (lines=18) @@ | ||
| 1 | <?php |
|
| 2 | //require_once(dirname(__FILE__).'/../api/v1/users.php'); |
|
| 3 | ||
| 4 | function validEmail($email) |
|
| 5 | { |
|
| 6 | if(filter_var($email) === false) |
|
| 7 | { |
|
| 8 | return false; |
|
| 9 | } |
|
| 10 | $pos = strpos($email, '@'); |
|
| 11 | if($pos === false) |
|
| 12 | { |
|
| 13 | return false; |
|
| 14 | } |
|
| 15 | $domain = substr($email, $pos+1); |
|
| 16 | if(checkdnsrr($domain, 'MX') === false) |
|
| 17 | { |
|
| 18 | return false; |
|
| 19 | } |
|
| 20 | return true; |
|
| 21 | } |
|
| 22 | ||
| 23 | class UserTest extends PHPUnit_Framework_TestCase |
|
| 24 | { |
|