1
0
mirror of https://github.com/wallabag/wallabag.git synced 2024-12-18 03:09:49 +01:00

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

fix : 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
src/Wallabag/CoreBundle
Resources/views/themes
baggy/Entry
material/Entry
Tests/Twig

View File

@ -1,12 +1,12 @@
{% extends "WallabagCoreBundle::layout.html.twig" %} {% extends "WallabagCoreBundle::layout.html.twig" %}
{% block title %}{{ entry.title|raw }} ({{ entry.domainName }}){% endblock %} {% block title %}{{ entry.title|raw }} ({{ entry.domainName|removeWww }}){% endblock %}
{% block content %} {% block content %}
<div id="article_toolbar"> <div id="article_toolbar">
<ul class="links"> <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 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 %}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 %}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> <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" %} {% extends "WallabagCoreBundle::layout.html.twig" %}
{% block title %}{{ entry.title|raw }} ({{ entry.domainName }}){% endblock %} {% block title %}{{ entry.title|raw }} ({{ entry.domainName|removeWww }}){% endblock %}
{% block menu %} {% block menu %}
<div class="progress"> <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> <h1>{{ entry.title|raw }} <a href="{{ path('edit', { 'id': entry.id }) }}" title="{% trans %}Edit title{% endtrans %}">✎</a></h1>
</header> </header>
<aside> <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"> <div id="list">
{% for tag in entry.tags %} {% for tag in entry.tags %}
<div class="chip"> <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'));
}
}