Skip to content

Commit

Permalink
Merge branch 'development'
Browse files Browse the repository at this point in the history
  • Loading branch information
Rasanga committed Dec 18, 2014
2 parents 9c2837f + f058e1c commit 09be166
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
8 changes: 5 additions & 3 deletions Controller/AlertController.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,17 @@ class AlertController extends Controller
* @deprecated
*
* @param bool $isAddStyles
* @param bool $isAddJsAlertClose
* @return \Symfony\Component\HttpFoundation\Response
*/
public function displayAlertsAction($isAddStyles = true)
public function displayAlertsAction($isAddStyles = true, $isAddJsAlertClose = true)
{
return $this->render(
'RasFlashAlertBundle::layout.html.twig',
array(
'alertPublisher' => $this->getAlertPublisher(),
'isAddStyles' => $isAddStyles
'alertPublisher' => $this->getAlertPublisher(),
'isAddStyles' => $isAddStyles,
'isAddJsAlertClose' => $isAddJsAlertClose
)
);
}
Expand Down
2 changes: 1 addition & 1 deletion Resources/config/routing.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
ras_flash_alert_display_alerts:
path: /display_alerts
path: /ras_flash_alert/display_alerts
defaults: { _controller: RasFlashAlertBundle:Alert:displayAlerts }
15 changes: 9 additions & 6 deletions Tests/Controller/AlertControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,24 @@ class AlertControllerTest extends WebTestCase
public function testDisplayAlerts()
{
$client = static::createClient();
$client->request('GET', '/display_alerts');
$client->request('GET', '/ras_flash_alert/display_alerts');

$this->assertEquals(Response::HTTP_OK, $client->getResponse()->getStatusCode());

$client = static::createClient();
/** @var AlertReporter $alertService */
$alertService = $client->getContainer()->get('ras_flash_alert.alert_reporter');
/** @var AlertReporter $alertReporter */
$alertReporter = $client->getContainer()->get('ras_flash_alert.alert_reporter');
$alertMessage = "Test error flash alert";
$alertService->addError($alertMessage);
$crawler1 = $client->request('GET', '/display_alerts');
$alertReporter->addError($alertMessage);

$crawler1 = $client->request('GET', '/ras_flash_alert/display_alerts');

print_r($client->getResponse()->getContent());

// Test: flash alert that has been added recently
$this->assertTrue($crawler1->filter("html:contains(\"{$alertMessage}\")")->count() === 1);

$crawler2 = $client->request('GET', '/display_alerts');
$crawler2 = $client->request('GET', '/ras_flash_alert/display_alerts');

// Test: flash alert has already been retrieved
$this->assertTrue($crawler2->filter("html:contains(\"{$alertMessage}\")")->count() === 0);
Expand Down

0 comments on commit 09be166

Please sign in to comment.