You are here

public function DefinitionTest::testMethodCalls in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/symfony/dependency-injection/Tests/DefinitionTest.php \Symfony\Component\DependencyInjection\Tests\DefinitionTest::testMethodCalls()

@covers Symfony\Component\DependencyInjection\Definition::setMethodCalls @covers Symfony\Component\DependencyInjection\Definition::addMethodCall @covers Symfony\Component\DependencyInjection\Definition::hasMethodCall @covers Symfony\Component\DependencyInjection\Definition::removeMethodCall

File

vendor/symfony/dependency-injection/Tests/DefinitionTest.php, line 96

Class

DefinitionTest

Namespace

Symfony\Component\DependencyInjection\Tests

Code

public function testMethodCalls() {
  $def = new Definition('stdClass');
  $this
    ->assertSame($def, $def
    ->setMethodCalls(array(
    array(
      'foo',
      array(
        'foo',
      ),
    ),
  )), '->setMethodCalls() implements a fluent interface');
  $this
    ->assertEquals(array(
    array(
      'foo',
      array(
        'foo',
      ),
    ),
  ), $def
    ->getMethodCalls(), '->getMethodCalls() returns the methods to call');
  $this
    ->assertSame($def, $def
    ->addMethodCall('bar', array(
    'bar',
  )), '->addMethodCall() implements a fluent interface');
  $this
    ->assertEquals(array(
    array(
      'foo',
      array(
        'foo',
      ),
    ),
    array(
      'bar',
      array(
        'bar',
      ),
    ),
  ), $def
    ->getMethodCalls(), '->addMethodCall() adds a method to call');
  $this
    ->assertTrue($def
    ->hasMethodCall('bar'), '->hasMethodCall() returns true if first argument is a method to call registered');
  $this
    ->assertFalse($def
    ->hasMethodCall('no_registered'), '->hasMethodCall() returns false if first argument is not a method to call registered');
  $this
    ->assertSame($def, $def
    ->removeMethodCall('bar'), '->removeMethodCall() implements a fluent interface');
  $this
    ->assertEquals(array(
    array(
      'foo',
      array(
        'foo',
      ),
    ),
  ), $def
    ->getMethodCalls(), '->removeMethodCall() removes a method to call');
}