hasMethodCall example


  public function testProcessNoConsumers() {
    $container = $this->buildContainer();
    $container
      ->register('consumer_id', __NAMESPACE__ . '\ValidConsumer');

    $handler_pass = new TaggedHandlersPass();
    $handler_pass->process($container);

    $this->assertCount(2, $container->getDefinitions());
    $this->assertFalse($container->getDefinition('consumer_id')->hasMethodCall('addHandler'));
  }

  /** * Tests a required consumer with no handlers. * * @covers ::process */
  public function testProcessRequiredHandlers() {
    $container = $this->buildContainer();
    $container
      ->register('consumer_id', __NAMESPACE__ . '\ValidConsumer')
      


    public function testMethodCalls()
    {
        $def = new Definition('stdClass');
        $this->assertSame($def$def->setMethodCalls([['foo', ['foo']]]), '->setMethodCalls() implements a fluent interface');
        $this->assertEquals([['foo', ['foo']]]$def->getMethodCalls(), '->getMethodCalls() returns the methods to call');
        $this->assertSame($def$def->addMethodCall('bar', ['bar']), '->addMethodCall() implements a fluent interface');
        $this->assertEquals([['foo', ['foo']]['bar', ['bar']]]$def->getMethodCalls(), '->addMethodCall() adds a method to call');
        $this->assertSame($def$def->addMethodCall('foobar', ['foobar'], true), '->addMethodCall() implements a fluent interface with third parameter');
        $this->assertEquals([['foo', ['foo']]['bar', ['bar']]['foobar', ['foobar'], true]]$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->assertTrue($def->hasMethodCall('foobar'), '->hasMethodCall() returns true if first argument is a method to call registered');
        $this->assertSame($def$def->removeMethodCall('foobar'), '->removeMethodCall() implements a fluent interface');
        $this->assertEquals([['foo', ['foo']]]$def->getMethodCalls(), '->removeMethodCall() removes a method to call');
        $this->assertSame($def$def->setMethodCalls([['foobar', ['foobar'], true]]), '->setMethodCalls() implements a fluent interface with third parameter');
        $this->assertEquals([['foobar', ['foobar'], true]]$def->getMethodCalls(), '->addMethodCall() adds a method to call');
    }

    public function testExceptionOnEmptyMethodCall()
    {
        
Home | Imprint | This part of the site doesn't use cookies.