This repository has been archived by the owner on Oct 28, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
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
dc100d0
commit 9d44486
Showing
6 changed files
with
123 additions
and
20 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
81 changes: 81 additions & 0 deletions
81
src/Rotis/CourseMakerBundle/Tests/Controller/DefaultController.php
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,81 @@ | ||
<?php | ||
|
||
namespace Rotis\CourseMakerBundle\Tests\Controller; | ||
|
||
use atoum\AtoumBundle\Test\Units\WebTestCase; | ||
use atoum\AtoumBundle\Test\Controller\ControllerTest; | ||
|
||
/* | ||
* Here we will test for all public pages, | ||
* generated by any controller... | ||
*/ | ||
|
||
class DefaultController extends ControllerTest | ||
{ | ||
public function testAccueil() | ||
{ | ||
$this | ||
->request() | ||
->GET('/') | ||
->hasStatus(200) | ||
->hasHeader('Content-Type', 'text/html; charset=UTF-8') | ||
->crawler | ||
->hasElement('.hero-unit') # main title, "hero" block | ||
->end() | ||
->hasElement('a') | ||
->withContent('Inscription') | ||
->end() | ||
->hasElement('a') | ||
->withContent('Connexion') | ||
->end() | ||
->hasElement('a') | ||
->withContent('Contact') | ||
->end() | ||
; | ||
} | ||
|
||
public function test404() | ||
{ | ||
$this | ||
->request() | ||
->GET('/bloorp') | ||
->hasStatus(404) | ||
; | ||
} | ||
|
||
public function testContact() | ||
{ | ||
$this | ||
->request() | ||
->GET('/contact') | ||
->hasStatus(200) | ||
->hasHeader('Content-Type', 'text/html; charset=UTF-8') | ||
->crawler | ||
->hasElement('.hero-unit') # main title, "hero" block | ||
->end() | ||
->hasElement('a') | ||
->withContent('Accueil') | ||
->end() | ||
; | ||
} | ||
|
||
// temproray page, empty at the moment | ||
public function testInfosPratiques() | ||
{ | ||
$this | ||
->request() | ||
->GET('/infos_pratiques') | ||
->hasStatus(200) | ||
->hasHeader('Content-Type', 'text/html; charset=UTF-8') | ||
->crawler | ||
->hasElement('.hero-unit') # main title, "hero" block | ||
->end() | ||
->hasElement('a') | ||
->withContent('Accueil') | ||
->end() | ||
->hasElement('a') | ||
->withContent('Contact') | ||
->end() | ||
; | ||
} | ||
} |
17 changes: 0 additions & 17 deletions
17
src/Rotis/CourseMakerBundle/Tests/Controller/DefaultControllerTest.php
This file was deleted.
Oops, something went wrong.
31 changes: 31 additions & 0 deletions
31
src/Rotis/CourseMakerBundle/Tests/Controller/SecurityController.php
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 | ||
|
||
namespace Rotis\CourseMakerBundle\Tests\Controller; | ||
|
||
use atoum\AtoumBundle\Test\Units\WebTestCase; | ||
use atoum\AtoumBundle\Test\Controller\ControllerTest; | ||
|
||
/* | ||
* Here we will test for security: protected pages, | ||
* login for admins... | ||
*/ | ||
|
||
class SecurityController extends ControllerTest | ||
{ | ||
public function testAccueil() | ||
{ | ||
$this | ||
->request(array('username' => 'toto')) | ||
->GET('/login') | ||
->hasStatus(200) | ||
->hasHeader('Content-Type', 'text/html; charset=UTF-8') | ||
->crawler | ||
->hasElement('#username') | ||
->hasNoContent('toto') | ||
->end() | ||
->hasElement('#password') | ||
->hasNoContent() | ||
->end() | ||
; | ||
} | ||
} |