SupportCapsuleManagerTraitTest.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. namespace Illuminate\Tests\Support;
  3. use Illuminate\Config\Repository;
  4. use Illuminate\Container\Container;
  5. use Illuminate\Support\Fluent;
  6. use Illuminate\Support\Traits\CapsuleManagerTrait;
  7. use Mockery as m;
  8. use PHPUnit\Framework\TestCase;
  9. class SupportCapsuleManagerTraitTest extends TestCase
  10. {
  11. use CapsuleManagerTrait;
  12. protected function tearDown(): void
  13. {
  14. m::close();
  15. }
  16. public function testSetupContainerForCapsule()
  17. {
  18. $this->container = null;
  19. $app = new Container;
  20. $this->setupContainer($app);
  21. $this->assertEquals($app, $this->getContainer());
  22. $this->assertInstanceOf(Fluent::class, $app['config']);
  23. }
  24. public function testSetupContainerForCapsuleWhenConfigIsBound()
  25. {
  26. $this->container = null;
  27. $app = new Container;
  28. $app['config'] = m::mock(Repository::class);
  29. $this->setupContainer($app);
  30. $this->assertEquals($app, $this->getContainer());
  31. $this->assertInstanceOf(Repository::class, $app['config']);
  32. }
  33. }