getSomeParameter example

// Retrieve services of the container.     $other_service_class = $this->containerDefinition['services']['other.service']['class'];
    $other_service = $this->container->get('other.service');
    $this->assertInstanceOf($other_service_class$other_service);

    $some_parameter = $this->containerDefinition['parameters']['some_config'];
    $some_other_parameter = $this->containerDefinition['parameters']['some_other_config'];

    $service = $this->container->get('service.provider');

    $this->assertEquals($other_service$service->getSomeOtherService(), '@other.service was injected via constructor.');
    $this->assertEquals($some_parameter$service->getSomeParameter(), '%some_config% was injected via constructor.');
    $this->assertEquals($this->container, $service->getContainer(), 'Container was injected via setter injection.');
    $this->assertEquals($some_other_parameter$service->getSomeOtherParameter(), '%some_other_config% was injected via setter injection.');
    $this->assertEquals('foo', $service->someProperty, 'Service has added properties.');
  }

  /** * Tests that Container::get() for non-shared services works properly. * * @covers ::get * @covers ::createService */
  
Home | Imprint | This part of the site doesn't use cookies.