Skip to content

Commit

Permalink
2.0.1 Fixed PHP Unit Tests and 'Latest Logs' for listeners without S/P
Browse files Browse the repository at this point in the history
  • Loading branch information
classaxe committed Mar 21, 2020
1 parent 5a16769 commit a27323b
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 28 deletions.
25 changes: 1 addition & 24 deletions src/Repository/ListenerRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ private function getLatestLogsListenersForDate($system, $date)
{
$qb = $this
->createQueryBuilder('l')
->select('l.id, l.name, l.sp');
->select('l.id, l.name, l.sp, l.itu');
$this->addFilterSystem($qb, $system);
$qb
->andWhere('(l.logLatest = :date)')
Expand Down Expand Up @@ -753,27 +753,4 @@ public function getSignalsForListener($listenerID, array $args = [])
}
return $result;
}

public function getSignalTypesForListener($listenerID) {
$qb = $this
->createQueryBuilder('li')
->select('s.type')
->innerJoin('\App\Entity\Log', 'l')
->andWhere('l.listenerid = li.id')

->innerJoin('\App\Entity\Signal', 's')
->andWhere('l.signalid = s.id')

->andWhere('li.id = :listenerID')
->setParameter('listenerID', $listenerID)

->groupBy('s.type');

$results = $qb->getQuery()->execute();
$out = [];
foreach ($results as $result) {
$out[$result['type']] = $result['type'];
}
return $out;
}
}
8 changes: 8 additions & 0 deletions templates/admin/logon/index.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@
{% set form_title = 'Administrator Log On'|trans %}

{% block body %}
{% include 'js_trans.html.twig' %}
<script>
var system = '{{ system }}';
$(document).ready( function() {
setExternalLinks();
});
</script>

<div class="main">
<div>{% include 'status.html.twig' %}</div>
<h1>{% trans %}Log On{% endtrans %}</h1>
Expand Down
2 changes: 1 addition & 1 deletion templates/listeners/latestlogs.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<div class="small-12 medium-1"><strong>{{ "Latest Logs:" | trans }}</strong></div>
<div class="small-12 medium-11">
{% for l in latestLogs['listeners'] %}
<a href="{{ url('listener_logs', { 'system' : system, 'id': l.id }) }}" data-popup="1">{{ l.name|raw }}</a> <em>({{ l.sp ? l.sp : l.itu }})</em>{% if not loop.last %} &nbsp; | &nbsp; {% endif %}
<a href="{{ url('listener_logs', { 'system' : system, 'id': l.id }) }}" data-popup="1">{{ l.name|raw }}</a> ({{ l.sp ? l.sp : l.itu }}){% if not loop.last %} &nbsp; | &nbsp; {% endif %}
{% endfor %} &nbsp; <strong>({{ latestLogs['date'] }})</strong>
</div>
</div>
Expand Down
6 changes: 3 additions & 3 deletions tests/Controller/LogonLogoffTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function testAllSystems()
$this->setYesRedirect();

foreach ($this->getAdminUsers() as $user => $data) {
$this->myClient->request('GET', '/en/' . $system . '/admin/logoff');
$this->myClient->request('GET', "/en/{$system}/admin/logoff");

$form = $this
->getMyCrawler()
Expand All @@ -63,10 +63,10 @@ public function testAllSystems()
$data['valid'] ?
'You are now logged on as an Administrator and may perform administrative functions.'
:
'Error: Incorrect Username and / or Password.'
'Error: Incorrect Username and / or Password. X'
);

$errMsg = $this->getMyCrawler()->filter('div#lastError');
$errMsg = $this->getMyCrawler()->filter('span#lastError');
$okMsg = $this->getMyCrawler()->filter('p#success');

$actual = (
Expand Down

0 comments on commit a27323b

Please sign in to comment.