array('Local address', 'style="width: 150px;"'), array(NULL, 'style="width: 20px;"'), 'peer_ip' => array('Peer address', 'style="width: 150px;"'), 'type' => array('Type', 'style="width: 50px;"'), array('Family'), 'peer_as' => 'Remote AS', 'state' => 'State', 'Uptime / Updates', NULL ); $this->assertSame($result, get_table_header($cols, $vars)); } public function providerGetTableHeader() { return array( array( // Sorting enabled array('page' => 'routing', 'protocol' => 'bgp', 'type' => 'all'), ' Local address Peer address Type Family Remote AS State Uptime / Updates ' . PHP_EOL ), array( // Sorting enabled, selected type array('page' => 'routing', 'protocol' => 'bgp', 'type' => 'all', 'sort' => 'type'), ' Local address Peer address Type   Family Remote AS State Uptime / Updates ' . PHP_EOL ), array( // Sorting disabled array(), ' Local address Peer address Type Family Remote AS State Uptime / Updates ' . PHP_EOL ), ); } /** * @dataProvider providerGetForm * @group forms */ public function testGetForm($form, $html) { //echo "\n<<assertSame($html, generate_form($form)); } public function providerGetForm() { // Temporary use direct array, need switch to json+txt includes $array = []; $form = ['type' => 'horizontal', 'id' => 'logonform', //'space' => '20px', //'title' => 'Logon', //'icon' => 'oicon-key', 'class' => NULL, // Use empty class here, to not add additional divs 'fieldset' => ['logon' => 'Please log in:'], ]; $form['row'][0]['username'] = [ 'type' => 'text', 'fieldset' => 'logon', 'name' => 'Username', 'placeholder' => '', 'class' => 'input-xlarge', //'width' => '95%', 'value' => '']; $form['row'][1]['password'] = [ 'type' => 'password', 'fieldset' => 'logon', 'name' => 'Password', 'autocomplete' => TRUE, 'placeholder' => '', 'class' => 'input-xlarge', //'width' => '95%', 'value' => '']; $form['row'][3]['submit'] = [ 'type' => 'submit', 'name' => 'Log in', 'icon' => 'icon-lock', //'right' => TRUE, 'div_class' => 'controls', 'class' => 'btn-large']; $html = <<

Please log in:

FORM; $array[] = [$form, $html]; // Force text field with autocomplete OFF $form['row'][0]['username']['autocomplete'] = FALSE; $html = <<

Please log in:

FORM; $array[] = [$form, $html]; // Removed password autocomplete unset($form['row'][1]['password']['autocomplete'], $form['row'][0]['username']['autocomplete']); $html = <<

Please log in:

FORM; $array[] = [$form, $html]; // Append checkbox $form['row'][2]['remember'] = [ 'type' => 'checkbox', 'fieldset' => 'logon', 'placeholder' => 'Remember my login']; $html = <<

Please log in:

FORM; $array[] = [$form, $html]; return $array; } /** * @dataProvider providerGetMarkdown * @group html */ public function testGetMarkdown($text, $result, $extra = FALSE) { $this->assertSame($result, get_markdown($text, TRUE, $extra)); } public function providerGetMarkdown() { $array = []; // Simple $array[] = [ 'Hello _Observium_!', 'Hello Observium!' ]; $array[] = [ 'an autolink http://example.com', 'an autolink http://example.com' ]; $array[] = [ 'inside of brackets [http://example.com], inside of braces {http://example.com}, inside of parentheses (http://example.com)', 'inside of brackets [http://example.com], inside of braces {http://example.com}, inside of parentheses (http://example.com)' ]; $array[] = [ 'trailing slash http://example.com/ and http://example.com/path/', 'trailing slash http://example.com/ and http://example.com/path/' ]; // Extra $array[] = [ 'Please read [FAQ](' . OBSERVIUM_DOCS_URL . '/faq/#snmpv3-strong-authentication-or-encryption){target=_blank}.', 'Please read FAQ.', TRUE ]; // Multiline $text = <<

Welcome to the demo:

  1. Write Markdown text on the left
  2. Hit the Parse button or ⌘ + Enter
  3. See the result to on the right
HTML; $array[] = [ $text, $html ]; return $array; } } // EOF