You are here

public function RulesConditionalFrameworkTestCase::testFluentInterface in Conditional Rules 7

Same name and namespace in other branches
  1. 8 tests/rules_conditional.test \RulesConditionalFrameworkTestCase::testFluentInterface()

Tests fluent interface.

File

tests/rules_conditional.test, line 94
SimpleTest testing suites.

Class

RulesConditionalFrameworkTestCase
Framework tests.

Code

public function testFluentInterface() {
  $container = new RulesConditionalTestStubContainer();
  $actions1 = new RulesActionSet();
  $container
    ->fluent($actions1)
    ->action('drupal_message', array(
    'message' => '[site:name]',
  ));
  $this
    ->assertEqual(1, count($actions1
    ->elements()), 'Fluent interface adds action to the active element.');
  $actions2 = new RulesActionSet();
  $container
    ->fluent($actions2)
    ->action('drupal_message', array(
    'message' => '[site:name]',
  ));
  $this
    ->assertEqual(1, count($actions1
    ->elements()), 'Fluent interface does not add action to a previously active element.');
}