-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
db8152d
commit 21b6a3c
Showing
9 changed files
with
191 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
/* | ||
* For the full copyright and license information, please view the LICENSE file | ||
* that was distributed with this source code. | ||
*/ | ||
|
||
namespace AppBundle\Controller; | ||
|
||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; | ||
use Symfony\Bundle\FrameworkBundle\Controller\Controller; | ||
use Symfony\Component\HttpFoundation\Request; | ||
use Symfony\Component\HttpFoundation\Response; | ||
|
||
/** | ||
* SidebarController. | ||
*/ | ||
class SidebarController extends Controller | ||
{ | ||
/** | ||
* @Route("/", name="app_dashboard") | ||
* | ||
* @param Request $request Request | ||
* | ||
* @return Response | ||
*/ | ||
public function dashboardAction(Request $request) | ||
{ | ||
return $this->render('user/pages/dashboard.html.twig', []); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
<?php | ||
|
||
/* | ||
* For the full copyright and license information, please view the LICENSE file | ||
* that was distributed with this source code. | ||
*/ | ||
|
||
namespace AppBundle\Controller; | ||
|
||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; | ||
|
||
/** | ||
* SidebarControllerTest. | ||
* | ||
* @coversDefaultClass \AppBundle\Controller\SidebarController | ||
*/ | ||
class SidebarControllerTest extends WebTestCase | ||
{ | ||
/** | ||
* @Test | ||
*/ | ||
public function testDashboard() | ||
{ | ||
$authClient = (new \TestClient('test', 'test'))->auth(); | ||
|
||
$crawler = $authClient->request('GET', '/profile'); | ||
$this->assertSame('Profile', trim($crawler->filter('.title_left h3')->text())); | ||
|
||
$link = $authClient->getCrawler()->filter('.site_title')->link(); | ||
$crawler = $authClient->click($link); | ||
$this->assertSame('Network Activities Graph title sub-title', trim($crawler->filter('.right_col h3')->text())); | ||
} | ||
|
||
/** | ||
* @Test | ||
*/ | ||
public function testLogo() | ||
{ | ||
$client = (new \TestClient('test', 'test'))->auth(); | ||
|
||
$link = $client->getCrawler()->selectLink('Dashboard')->link(); | ||
$crawler = $client->click($link); | ||
$this->assertSame('Network Activities Graph title sub-title', trim($crawler->filter('.right_col h3')->text())); | ||
} | ||
|
||
/** | ||
* @Test | ||
*/ | ||
public function testGoTemplateReturnApp() | ||
{ | ||
$client = (new \TestClient('test', 'test'))->auth(); | ||
|
||
// Go to the template | ||
$link = $client->getCrawler()->selectLink('Template')->link(); | ||
$crawler = $client->click($link); | ||
|
||
// Return to the application | ||
$linkBack = $crawler->selectLink('Back to the application'); | ||
$this->assertSame('Back to the application', $linkBack->text()); | ||
$crawler = $client->click($linkBack->link()); | ||
$this->assertSame('Network Activities Graph title sub-title', trim($crawler->filter('.right_col h3')->text())); | ||
} | ||
|
||
/** | ||
* @covers :: gentelellaAction | ||
*/ | ||
public function testPageNotFound() | ||
{ | ||
$client = (new \TestClient('test', 'test')); | ||
$authClient = $client->auth(); | ||
$crawler = $authClient->request('GET', 'fake-page'); | ||
$this->assertSame('404', $crawler->filter('.error-number')->text()); | ||
$client->logout(); | ||
} | ||
|
||
/** | ||
* @Test | ||
*/ | ||
public function testLogoutAction() | ||
{ | ||
$client = new \TestClient('test', 'test'); | ||
|
||
$authClient = $client->auth(); | ||
$link = $authClient->getCrawler()->filter('div.sidebar-footer a')->last()->link(); | ||
$authClient->click($link); | ||
$authClient->followRedirect(); | ||
$authClient->followRedirect(); // Logout makes 2 redirects | ||
$crawler = $authClient->getCrawler(); | ||
$this->assertSame('Login Form', trim($crawler->filter('h1')->text())); | ||
$client->logout(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters