public function test06_as_string() { $_GET['birthday'] = 1; $_GET['birthmonth'] = 2; $_GET['birthyear'] = 3; $birthday = new birthday(); $this->assertEquals('3-2-1', $birthday->as_string()); $birthday->day = ''; $this->assertEquals('', $birthday->as_string()); }
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero // General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program in a file in the toplevel directory called // "AGPLv3". If not, see <http://www.gnu.org/licenses/>. // // Authors: // Morgan Manach <*****@*****.**> // Loic Dachary <*****@*****.**> // require_once 'common.php'; require_once 'birthday.php'; $birthday = new birthday(); if (_post_string('submit')) { $account = array('name' => _post_string('name'), 'password' => _post_string('password'), 'password2' => _post_string('password2'), 'email' => _post_string('email'), 'firstname' => _post_string('firstname'), 'lastname' => _post_string('lastname'), 'addr_street' => _post_string('addr_street'), 'addr_street2' => _post_string('addr_street2'), 'addr_zip' => _post_string('addr_zip'), 'addr_town' => _post_string('addr_town'), 'addr_state' => _post_string('addr_state'), 'addr_country' => _post_string('addr_country'), 'phone' => _post_string('phone'), 'gender' => _post_string('gender'), 'birthdate' => $birthday->as_string()); try { if ($account['password'] != $account['password2']) { throw new Exception('Password and confirmation must be the same.'); } if ($account['email'] == '') { throw new Exception('Email is mandatory'); } $poker->send(array('type' => 'PacketPokerCreateAccount', 'name' => $account['name'], 'password' => $account['password'], 'email' => $account['email'], 'firstname' => $account['firstname'], 'lastname' => $account['lastname'], 'addr_street' => $account['addr_street'], 'addr_street2' => $account['addr_street2'], 'addr_zip' => $account['addr_zip'], 'addr_town' => $account['addr_town'], 'addr_state' => $account['addr_state'], 'addr_country' => $account['addr_country'], 'phone' => $account['phone'], 'gender' => $account['gender'], 'birthdate' => $account['birthdate'], 'affiliate' => 4242)); $poker->login($account['name'], $account['password']); header('Location: index.php?comment=Account%20created.'); die; } catch (Exception $e) { $poker_error = $e->getMessage(); } } else {