'99'); ob_start(); include __DIR__.'/../../web/ajax/modals/device.php'; $html = ob_get_clean(); check('no warnings for a missing device row', count($warnings) === 0); check('modal falls back to a new device', strpos($html, 'New Device') !== false && strpos($html, 'name="did" value=""') !== false); $warnings = array(); $user = new stdClass(); $_REQUEST = array('action' => 'delete', 'markDids' => '7'); include __DIR__.'/../../web/ajax/devices.php'; check('scalar markDids deletes that device', $deleted === array('7')); check('scalar markDids raises no warning', count($warnings) === 0); $deleted = array(); $_REQUEST = array('action' => 'delete', 'markDids' => array('3', array('x'), '4')); include __DIR__.'/../../web/ajax/devices.php'; check('nested markDids entries are skipped', $deleted === array('3', '4') && count($warnings) === 0); echo "\n$tests tests, $failures failures\n"; exit($failures ? 1 : 0); }