@ -216,27 +216,79 @@ class FormatterTest extends TestCase
{
$value = 'http://www.yiiframework.com/';
$this->assertSame("< a href = \"$value\" > $value< / a > ", $this->formatter->asUrl($value));
$this->assertSame("< a href = \"$value\" > $value< / a > ", $this->formatter->asUrl($value, [], false));
$this->assertSame("< a href = \"$value\" > $value< / a > ", $this->formatter->asUrl($value, [], true));
$this->assertSame("< a href = \"$value\" > $value< / a > ", $this->formatter->asUrl($value, [], 'http'));
$this->assertSame("< a href = \"$value\" > $value< / a > ", $this->formatter->asUrl($value, [], 'https'));
$this->assertSame("< a href = \"$value\" > $value< / a > ", $this->formatter->asUrl($value, [], ''));
$this->assertSame("< a href = \"$value\" > $value< / a > ", $this->formatter->asUrl($value, ['scheme' => null]));
$this->assertSame("< a href = \"$value\" > $value< / a > ", $this->formatter->asUrl($value, ['scheme' => false]));
$this->assertSame("< a href = \"$value\" > $value< / a > ", $this->formatter->asUrl($value, ['scheme' => 'http']));
$this->assertSame(
"< a href = \"https://www.yiiframework.com/\" > $value< / a > ",
$this->formatter->asUrl($value, ['scheme' => 'https'])
);
$this->assertSame(
"< a href = \"//www.yiiframework.com/\" > $value< / a > ",
$this->formatter->asUrl($value, ['scheme' => ''])
);
$value = 'https://www.yiiframework.com/';
$this->assertSame("< a href = \"$value\" > $value< / a > ", $this->formatter->asUrl($value));
$this->assertSame("< a href = \"$value\" > $value< / a > ", $this->formatter->asUrl($value, [], false));
$this->assertSame("< a href = \"$value\" > $value< / a > ", $this->formatter->asUrl($value, [], true));
$this->assertSame("< a href = \"$value\" > $value< / a > ", $this->formatter->asUrl($value, [], 'http'));
$this->assertSame("< a href = \"$value\" > $value< / a > ", $this->formatter->asUrl($value, [], 'https'));
$this->assertSame("< a href = \"$value\" > $value< / a > ", $this->formatter->asUrl($value, [], ''));
$this->assertSame("< a href = \"$value\" > $value< / a > ", $this->formatter->asUrl($value, ['scheme' => false]));
$this->assertSame("< a href = \"$value\" > $value< / a > ", $this->formatter->asUrl($value, ['scheme' => null]));
$this->assertSame(
"< a href = \"http://www.yiiframework.com/\" > $value< / a > ",
$this->formatter->asUrl($value, ['scheme' => 'http'])
);
$this->assertSame("< a href = \"$value\" > $value< / a > ", $this->formatter->asUrl($value, ['scheme' => 'https']));
$this->assertSame(
"< a href = \"//www.yiiframework.com/\" > $value< / a > ",
$this->formatter->asUrl($value, ['scheme' => ''])
);
$value = 'www.yiiframework.com/';
$this->assertSame("< a href = \"http://$value\" > $value< / a > ", $this->formatter->asUrl($value));
$this->assertSame("< a href = \"http://$value\" > $value< / a > ", $this->formatter->asUrl($value, [], false));
$this->assertSame("< a href = \"https://$value\" > $value< / a > ", $this->formatter->asUrl($value, [], true));
$this->assertSame("< a href = \"http://$value\" > $value< / a > ", $this->formatter->asUrl($value, [], 'http'));
$this->assertSame("< a href = \"https://$value\" > $value< / a > ", $this->formatter->asUrl($value, [], 'https'));
$this->assertSame("< a href = \"//$value\" > $value< / a > ", $this->formatter->asUrl($value, [], ''));
$this->assertSame(
"< a href = \"http://www.yiiframework.com/\" > $value< / a > ",
$this->formatter->asUrl($value)
);
$this->assertSame("< a href = \"$value\" > $value< / a > ", $this->formatter->asUrl($value, ['scheme' => false]));
$this->assertSame(
"< a href = \"http://www.yiiframework.com/\" > $value< / a > ",
$this->formatter->asUrl($value, ['scheme' => null])
);
$this->assertSame("< a href = \"$value\" > $value< / a > ", $this->formatter->asUrl($value, ['scheme' => 'http']));
$this->assertSame("< a href = \"$value\" > $value< / a > ", $this->formatter->asUrl($value, ['scheme' => 'https']));
$this->assertSame("< a href = \"$value\" > $value< / a > ", $this->formatter->asUrl($value, ['scheme' => '']));
$value = '//www.yiiframework.com/';
$this->assertSame(
"< a href = \"http:////www.yiiframework.com/\" > $value< / a > ", // invalid but this is how it works
$this->formatter->asUrl($value)
);
$this->assertSame("< a href = \"$value\" > $value< / a > ", $this->formatter->asUrl($value, ['scheme' => false]));
$this->assertSame(
"< a href = \"http:////www.yiiframework.com/\" > $value< / a > ", // invalid but this is how it works
$this->formatter->asUrl($value, ['scheme' => null])
);
$this->assertSame(
"< a href = \"http://www.yiiframework.com/\" > $value< / a > ",
$this->formatter->asUrl($value, ['scheme' => 'http'])
);
$this->assertSame(
"< a href = \"https://www.yiiframework.com/\" > $value< / a > ",
$this->formatter->asUrl($value, ['scheme' => 'https'])
);
$this->assertSame("< a href = \"$value\" > $value< / a > ", $this->formatter->asUrl($value, ['scheme' => '']));
$value = '/books/about/yii';
$this->assertSame(
"< a href = \"http:///books/about/yii\" > $value< / a > ", // invalid but this is how it works
$this->formatter->asUrl($value)
);
$this->assertSame("< a href = \"$value\" > $value< / a > ", $this->formatter->asUrl($value, ['scheme' => false]));
$this->assertSame(
"< a href = \"http:///books/about/yii\" > $value< / a > ", // invalid but this is how it works
$this->formatter->asUrl($value, ['scheme' => null])
);
$this->assertSame("< a href = \"$value\" > $value< / a > ", $this->formatter->asUrl($value, ['scheme' => 'http']));
$this->assertSame("< a href = \"$value\" > $value< / a > ", $this->formatter->asUrl($value, ['scheme' => 'https']));
$this->assertSame("< a href = \"$value\" > $value< / a > ", $this->formatter->asUrl($value, ['scheme' => '']));
$value = 'https://www.yiiframework.com/?name=test&value=5"';
$this->assertSame(