\Chill\ReportBundle\Tests\ControllerReportControllerTest

Test the life cycles of controllers, according to https://redmine.champs-libres.coop/projects/report/wiki/Test_plan_for_report_lifecycle

Summary

Methods
Properties
Constants
setUpBeforeClass()
testMenu()
testChooseReportModelPage()
testNewReportPage()
testNullDate()
testInvalidDate()
testInvalidUser()
testValidCreate()
testList()
testView()
testUpdate()
testLinkToTheExportReport()
testFormForExportAction()
testCSVExportAction()
No public properties found
REPORT_NAME_FIELD
No protected methods found
No protected properties found
N/A
isFormAsExpected()
fillCorrectForm()
$person
$client
$user
$em
N/A

Constants

REPORT_NAME_FIELD

REPORT_NAME_FIELD

Properties

$person

$person : \Chill\PersonBundle\Entity\Person

Type

\Chill\PersonBundle\Entity\Person

$client

$client : \SClientymfony\Component\BrowserKit\

Type

\SClientymfony\Component\BrowserKit\

$user

$user : 

Type

$em

$em : \Doctrine\ORM\EntityManagerInterface

Type

\Doctrine\ORM\EntityManagerInterface

Methods

setUpBeforeClass()

setUpBeforeClass() 

testMenu()

testMenu() 

Set up the browser to be at a random person general page (/fr/person/%d/general), check if there is a menu link for adding a new report and return this link (as producer)

We assume that :

  • we are on a "person" page
  • there are more than one report model

testChooseReportModelPage()

testChooseReportModelPage(\Symfony\Component\DomCrawler\Link  $link) : \Chill\ReportBundle\Tests\Controller\type

Parameters

\Symfony\Component\DomCrawler\Link $link

Returns

\Chill\ReportBundle\Tests\Controller\type

testNewReportPage()

testNewReportPage(\Symfony\Component\DomCrawler\Crawler  $crawlerNewReportPage) : \Chill\ReportBundle\Tests\Controller\type

Parameters

\Symfony\Component\DomCrawler\Crawler $crawlerNewReportPage

Returns

\Chill\ReportBundle\Tests\Controller\type

testNullDate()

testNullDate(\Symfony\Component\DomCrawler\Form  $form) 

Test that setting a Null date redirect to an error page

Parameters

\Symfony\Component\DomCrawler\Form $form

testInvalidDate()

testInvalidDate(\Symfony\Component\DomCrawler\Form  $form) 

Test that setting a Null date redirect to an error page

Parameters

\Symfony\Component\DomCrawler\Form $form

testInvalidUser()

testInvalidUser(\Symfony\Component\DomCrawler\Form  $form) 

Test that a incorrect value in user will show an error page

Parameters

\Symfony\Component\DomCrawler\Form $form

testValidCreate()

testValidCreate(\Symfony\Component\DomCrawler\Form  $addForm) 

Test the creation of a report

Parameters

\Symfony\Component\DomCrawler\Form $addForm

testList()

testList(integer  $reportId) 

Parameters

integer $reportId

testView()

testView(integer  $reportId) 

Test the view of a report

Parameters

integer $reportId

testUpdate()

testUpdate(integer  $reportId) 

test the update form

Parameters

integer $reportId

testLinkToTheExportReport()

testLinkToTheExportReport() : \Symfony\Component\DomCrawler\Link

Test that in the general export page there is an Export reports link that leads to export/report/select/type

Returns

\Symfony\Component\DomCrawler\Link —

The link to the the form use for selecting which type of report to export

testFormForExportAction()

testFormForExportAction(\Symfony\Component\DomCrawler\Link  $link) : Integer

Test the export form for selecting the type of report to export : - follow the given link ( export/report/select/type ) - choose randomly a type of report (CustomFieldsGroup) - submit the form

Parameters

\Symfony\Component\DomCrawler\Link $link

Returns

Integer —

The id of the type of report selected (CFGroup)

testCSVExportAction()

testCSVExportAction(  $cfGroupId) 

Test the output of the export action : - check if a csv file is well received - check if the csv is well formated (if each row has the same number of cells) - check if the number of data rows (not the header) of the csv file is as expected (number of report of this type)

Parameters

$cfGroupId

isFormAsExpected()

isFormAsExpected(\Symfony\Component\DomCrawler\Form  $form, boolean  $isDefault = true) 

Test the expected field are present

Parameters

\Symfony\Component\DomCrawler\Form $form
boolean $isDefault

if the form should be at default values

fillCorrectForm()

fillCorrectForm(\Symfony\Component\DomCrawler\Form  $form) 

fill the form with correct data

Parameters

\Symfony\Component\DomCrawler\Form $form