Skip to content

Commit

Permalink
test(listcontrollertest): added a new test for list page
Browse files Browse the repository at this point in the history
  • Loading branch information
alfredoct96 committed Mar 16, 2022
1 parent ea9ec1f commit 057b461
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions app/bundles/LeadBundle/Tests/Controller/ListControllerTest.php
Expand Up @@ -3,10 +3,33 @@
namespace Mautic\LeadBundle\Tests\Controller;

use Mautic\CoreBundle\Test\MauticMysqlTestCase;
use Mautic\CoreBundle\Tests\Traits\ControllerTrait;
use Mautic\LeadBundle\Entity\LeadList;

class ListControllerTest extends MauticMysqlTestCase
{
use ControllerTrait;

/**
* Index action should return status code 200.
*/
public function testIndexAction(): void
{
$list = $this->createList();

$this->em->persist($list);
$this->em->flush();
$this->em->clear();

$urlAlias = 'segments';
$routeAlias = 'leadlist';
$column = 'dateModified';
$column2 = 'name';
$tableAlias = 'l.';

$this->getControllerColumnTests($urlAlias, $routeAlias, $column, $tableAlias, $column2);
}

/**
* Check if list contains correct values.
*/
Expand Down Expand Up @@ -48,6 +71,9 @@ private function createList(string $suffix = 'A'): LeadList
$list->setName("Segment $suffix");
$list->setPublicName("Segment $suffix");
$list->setAlias("segment-$suffix");
$list->setDateAdded(new \DateTime('2020-02-07 20:29:02'));
$list->setDateModified(new \DateTime('2020-03-21 20:29:02'));
$list->setCreatedByUser('Test User');

return $list;
}
Expand Down

0 comments on commit 057b461

Please sign in to comment.