Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 7977bb4936
Fetching contributors…

Cannot retrieve contributors at this time

60 lines (38 sloc) 1.54 kb
<?php
namespace FreeAgent\Bundle\WorkflowBundle\Tests\Manager;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
use FreeAgent\Bundle\WorkflowBundle\Model\Example as ModelExample;
class ManagerTest extends WebTestCase
{
private function getManager()
{
$client = static::createClient();
$manager = $client->getContainer()->get('free_agent_workflow.manager');
$model = new ModelExample();
$manager->setModel($model);
$manager->configureWorkflow($model->getWorkflowName());
$workflowDefaultStepName = $manager->getDefaultStepName();
$manager->getModel()->setWorkflowStepName($workflowDefaultStepName);
return $manager;
}
public function testWorkflowCurrentStepName()
{
$manager = $this->getManager();
$workflowDefaultStepName = $manager->getDefaultStepName();
$workflowCurrentStepName = $manager->getCurrentStepName();
$this->assertEquals($workflowDefaultStepName, $workflowCurrentStepName);
}
public function testCanReachStep()
{
$manager = $this->getManager();
// Already at step
$canReachStep = $manager->canReachStep('draft');
$this->assertEquals(false, $canReachStep);
// Step not reachable
$canReachStep = $manager->canReachStep('published');
$this->assertEquals(false, $canReachStep);
// Step reachable
$canReachStep = $manager->canReachStep('removed');
$this->assertEquals(true, $canReachStep);
}
}
Jump to Line
Something went wrong with that request. Please try again.