Get support for KnpLabs/knpTestPlugin

If you're new to LTH, please see our FAQ for more information on what it is we do.

Support Options

Unfortunately, there are currently no active helpers for this repository on the platform. Until they become available, we reccomend the following actions:

View Open Issues

Take a look to see if anyone else has experienced the same issue as you and if they managed to solve it.

Open an Issue

Make sure to read any relevant guidelines for opening issues on this repo before posting a new issue.

Sponsor directly

Check out the page and see if there are any options to sponsor this project or it's developers directly.

KnpLabs/knpTestPlugin

knpTestPlugin

Enable the plugin.

Create your base test class which should inherit knpFunctionalTest or knpShortcutFunctionalTest (provides convenience shortcuts).

Requires a getDoctrineConnection() method.

<?php

class adminFunctionalTest extends knpLimeFunctionalTest
{

  protected function getDoctrineConnection()
  {
    return Doctrine::getTable('Product')->getConnection(); 
  }

  protected function login($login = 'knplabs', $password = 'loremipsum')
  {
    // Some logic here
  }
}

Add these lines to your /test/bootstrap/functional.php.

require_once($configuration->getRootDir(). '/plugins/knpTestPlugin/knpFunctionalTest.class.php');
// If adminFunctionalTest is your base test class:
require_once(dirname(__FILE__) . '/adminFunctionalTest.class.php');

Then create a test class for your functional tests; every test inside should use test* as method name. Each of these methods will be called inside a Doctrine transaction so that the DB is not changed.

<?php

include(dirname(__FILE__).'/../../bootstrap/functional.php');

class productActionsTest extends adminFunctionalTest
{
  public function testCreateSector()
  {
    $this
    ->get('/sector/new')
    ->setField('name', 'knplabs')
    ->click('Go on')
    ->with('response')->begin()
      ->matches("Right")
    ->end()
    ;
  }

  public function testOtherThing()
  {
    …
  }
}

$test = new productActionsTest();
$test->run();
Our Mission

We want to make open source more sustainable. The entire platform was born from this and everything we do is in aid of this.

Interesting Articles

Thank you for checking out LiveTechHelper |
2025 © lth-dev incorporated

p-e622a1a2