Пример #1
0
 /**
  * @test
  * it should allow a service provider to bind at boot
  */
 public function it_should_allow_a_service_provider_to_bind_at_boot()
 {
     $container = new tad_DI52_Container();
     $container->register('ServiceProviderTwo');
     $container->boot();
     $out = $container->make('TestInterfaceThree');
     $this->assertInstanceOf('TestInterfaceThree', $out);
 }
 /**
  * @test
  * it should allow a deferred service provider to bind and singleton classes
  */
 public function it_should_allow_a_deferred_service_provider_to_bind_and_singleton_classes()
 {
     $container = new tad_DI52_Container();
     $container->register('DeferredServiceProviderThree');
     $instance1 = $container->resolve('TestInterfaceOne');
     $instance2 = $container->resolve('TestInterfaceOne');
     $this->assertSame($instance1, $instance2);
     $instance3 = $container->resolve('TestInterfaceTwo');
     $instance4 = $container->resolve('TestInterfaceTwo');
     $this->assertEquals($instance3, $instance4);
     $this->assertNotSame($instance3, $instance4);
 }
Пример #3
0
<?php

$container = new tad_DI52_Container();
$container->register('idlikethis_ServiceProviders_Shortcodes');
$container->register('idlikethis_ServiceProviders_Endpoints');
$container->register('idlikethis_ServiceProviders_Scripts');
$container->register('idlikethis_ServiceProviders_CommentsTable');
$container->register('idlikethis_ServiceProviders_MetaBoxes');
return $container;