Merge pull request #1461 from wallabag/v2-test-for-www

fix #1433: add test for removeWww Twig Extension
This commit is contained in:
Jeremy Benoist 2015-10-06 09:16:52 +02:00
commit fdef5f4605
3 changed files with 21 additions and 4 deletions

View file

@ -1,12 +1,12 @@
{% extends "WallabagCoreBundle::layout.html.twig" %}
{% block title %}{{ entry.title|raw }} ({{ entry.domainName }}){% endblock %}
{% block title %}{{ entry.title|raw }} ({{ entry.domainName|removeWww }}){% endblock %}
{% block content %}
<div id="article_toolbar">
<ul class="links">
<li class="topPosF"><a href="#top" title="{% trans %}Back to top{% endtrans %}" class="tool top icon icon-arrow-up-thick"><span>{% trans %}Back to top{% endtrans %}</span></a></li>
<li><a href="{{ entry.url|e }}" target="_blank" title="{% trans %}original{% endtrans %} : {{ entry.title|e }}" class="tool link icon icon-link"><span>{{ entry.domainName }}</span></a></li>
<li><a href="{{ entry.url|e }}" target="_blank" title="{% trans %}original{% endtrans %} : {{ entry.title|e }}" class="tool link icon icon-link"><span>{{ entry.domainName|removeWww }}</span></a></li>
<li><a title="{% trans %}Mark as read{% endtrans %}" class="tool icon icon-check {% if entry.isArchived == 0 %}archive-off{% else %}archive{% endif %}" href="{{ path('archive_entry', { 'id': entry.id }) }}"><span>{% trans %}Toggle mark as read{% endtrans %}</span></a></li>
<li><a title="{% trans %}Favorite{% endtrans %}" class="tool icon icon-star {% if entry.isStarred == 0 %}fav-off{% else %}fav{% endif %}" href="{{ path('star_entry', { 'id': entry.id }) }}"><span>{% trans %}Toggle favorite{% endtrans %}</span></a></li>
<li><a title="{% trans %}Delete{% endtrans %}" class="tool delete icon icon-trash" href="{{ path('delete_entry', { 'id': entry.id }) }}"><span>{% trans %}Delete{% endtrans %}</span></a></li>

View file

@ -1,6 +1,6 @@
{% extends "WallabagCoreBundle::layout.html.twig" %}
{% block title %}{{ entry.title|raw }} ({{ entry.domainName }}){% endblock %}
{% block title %}{{ entry.title|raw }} ({{ entry.domainName|removeWww }}){% endblock %}
{% block menu %}
<div class="progress">
@ -144,7 +144,7 @@ main {
<h1>{{ entry.title|raw }} <a href="{{ path('edit', { 'id': entry.id }) }}" title="{% trans %}Edit title{% endtrans %}">✎</a></h1>
</header>
<aside>
<a href="{{ entry.url|e }}" target="_blank" title="{% trans %}original{% endtrans %} : {{ entry.title|e }}" class="tool link mdi-content-link"> <span>{{ entry.domainName }}</span></a>
<a href="{{ entry.url|e }}" target="_blank" title="{% trans %}original{% endtrans %} : {{ entry.title|e }}" class="tool link mdi-content-link"> <span>{{ entry.domainName|removeWww }}</span></a>
<div id="list">
{% for tag in entry.tags %}
<div class="chip">

View file

@ -0,0 +1,17 @@
<?php
namespace Wallabag\CoreBundle\Tests\Twig;
use Wallabag\CoreBundle\Twig\WallabagExtension;
class WallabagExtensionTest extends \PHPUnit_Framework_TestCase
{
public function testRemoveWww()
{
$extension = new WallabagExtension();
$this->assertEquals("lemonde.fr", $extension->removeWww('www.lemonde.fr'));
$this->assertEquals("lemonde.fr", $extension->removeWww('lemonde.fr'));
$this->assertEquals("gist.github.com", $extension->removeWww('gist.github.com'));
}
}