3v4l.org

run code in 300+ PHP versions simultaneously
<?php public function test_admin_login() { $this->url('?ENVIRONMENT=test'); $this->set_db(); self::$pdo->query('TRUNCATE TABLE mi_system_users; TRUNCATE TABLE mi_brands; TRUNCATE TABLE mi_customers'); $customer = new Model\Customer(); $customer->set_name('Many Colours Ltd.'); $customer_manager = new Model\Customer_manager($this->db); $customer_manager->create($customer); $brand = new Brand(); $brand->set_name('Green products'); $brand_manager = new Brands_manager($this->db); $brand_id = $brand_manager->create_brand($customer, $brand); authenticate('mi'); $auth = authenticate(); $password = $auth->db_salt('fred123ABC'); $system_user = new \Model\System_user(); $system_user->set_first_name('Fred') ->set_email('fred@mediainjection.com') ->set_username('fred') ->set_password($password) ->set_current_brand_id($brand_id) ->set_level(USER_LEVEL_ADMIN); $suser_manager = new Model\System_user_manager($this->db); $row_id = $suser_manager->create($system_user); $this->assertEquals(1, $row_id); // User created! Test login $this->byId('username')->value('fred'); $this->byId('password')->value('fred123ABC'); $this->byClassName('input_submit')->click(); sleep(4); $this->assertRegExp('/Main dashboard/', $this->source()); $this->assertRegExp('/Manage Settings/', $this->source()); }
Output for 5.4.0 - 5.4.11
Parse error: syntax error, unexpected 'public' (T_PUBLIC) in /in/bd40Z on line 3
Process exited with code 255.
Output for 5.3.0 - 5.3.21
Parse error: syntax error, unexpected T_PUBLIC in /in/bd40Z on line 3
Process exited with code 255.

preferences:
171.6 ms | 1395 KiB | 41 Q