public function testFormatAsEmail() { $this->assertEquals($this->e->formatAsEmail("*****@*****.**"), "*****@*****.**"); $this->assertEquals($this->e->formatAsEmail("*****@*****.**"), "*****@*****.**"); $this->assertEquals($this->e->formatAsEmail(" 1this12345@example.com"), "*****@*****.**"); $this->assertEquals($this->e->formatAsEmail("1this12345@example.com "), "*****@*****.**"); $this->assertEquals($this->e->formatAsEmail("1this12345 @example.com"), "*****@*****.**"); $this->assertEquals($this->e->formatAsEmail("1this12345@ example.com"), "*****@*****.**"); // Sad Path $this->assertNotEquals($this->e->formatAsEmail(" 1this12345@example.com"), " 1this12345@example.com"); $this->assertNotEquals($this->e->formatAsEmail("1this12345@example.com "), "1this12345@example.com "); $this->assertNotEquals($this->e->formatAsEmail("1this12345 @example.com"), "1this12345 @example.com"); $this->assertNotEquals($this->e->formatAsEmail("1this12345@ example.com"), "1this12345@ example.com"); }
static function grid($model = null) { if ($model == null) { return; } $html = ""; $header = ""; // build grid header foreach ($model[0]::$describe as $k => $v) { //ActiveRecord::println($v); $header .= "<th>" . $v["Field"] . "</th>"; } $header .= "<th></th><th></th>"; foreach ($model as $obj) { $html .= "<tr>"; foreach ($obj as $k => $v) { if ($k == "errors") { continue; } if (StringFunctions::startsWith($k, "_")) { continue; } $html .= "<td>{$v}</td>"; } $html .= "<td><a href='edit/{$obj->id}'>edit</a></td>"; $html .= "<td><a href='delete/{$obj->id}'>delete</a></td>"; $html .= "</tr>"; } $h = ""; //$h = "<div class='grid-container' width='100%'>"; //$h .= "<div class='grid-wrapper' style='height:150px; overflow:auto'>"; $h .= "<table class='grid' >" . "<thead><tr>" . $header . "</tr></thead><tbody>" . $html . "</body></table>"; //$h .= "</div>"; //$h .= "</div>"; echo $h; }