public function testAsUrl() { $value = 'http://www.yiiframework.com/'; $this->assertSame("<a href=\"{$value}\">{$value}</a>", $this->formatter->asUrl($value)); $value = 'https://www.yiiframework.com/'; $this->assertSame("<a href=\"{$value}\">{$value}</a>", $this->formatter->asUrl($value)); $value = 'www.yiiframework.com/'; $this->assertSame("<a href=\"http://{$value}\">{$value}</a>", $this->formatter->asUrl($value)); $value = 'https://www.yiiframework.com/?name=test&value=5"'; $this->assertSame("<a href=\"https://www.yiiframework.com/?name=test&value=5"\">https://www.yiiframework.com/?name=test&value=5"</a>", $this->formatter->asUrl($value)); // null display $this->assertSame($this->formatter->nullDisplay, $this->formatter->asUrl(null)); }