public function testAlias()
 {
     $c = new ProjectServiceContainer();
     $this->assertTrue($c->has('alias'));
     $this->assertSame($c->get('alias'), $c->get('bar'));
 }
Beispiel #2
0
 /**
  * @group legacy
  * @expectedDeprecation Checking for the existence of the "internal" private service is deprecated since Symfony 3.2 and won't be supported anymore in Symfony 4.0.
  */
 public function testCheckExistenceOfAnInternalPrivateServiceIsDeprecated()
 {
     $c = new ProjectServiceContainer();
     $c->has('internal');
 }
Beispiel #3
0
 /**
  * @covers Symfony\Component\DependencyInjection\Container::has
  */
 public function testHas()
 {
     $sc = new ProjectServiceContainer();
     $sc->set('foo', new \stdClass());
     $this->assertFalse($sc->has('foo1'), '->has() returns false if the service does not exist');
     $this->assertTrue($sc->has('foo'), '->has() returns true if the service exists');
     $this->assertTrue($sc->has('bar'), '->has() returns true if a get*Method() is defined');
     $this->assertTrue($sc->has('foo_bar'), '->has() returns true if a get*Method() is defined');
     $this->assertTrue($sc->has('foo.baz'), '->has() returns true if a get*Method() is defined');
 }
Beispiel #4
0
 /**
  * @group legacy
  * @requires function Symfony\Bridge\PhpUnit\ErrorAssert::assertDeprecationsAreTriggered
  */
 public function testCheckExistenceOfAnInternalPrivateServiceIsDeprecated()
 {
     $deprecations = array('Checking for the existence of the "internal" private service is deprecated since Symfony 3.2 and won\'t be supported anymore in Symfony 4.0.');
     ErrorAssert::assertDeprecationsAreTriggered($deprecations, function () {
         $c = new ProjectServiceContainer();
         $c->has('internal');
     });
 }