diff options
Diffstat (limited to 'tests/units')
-rw-r--r-- | tests/units/Base.php | 1 | ||||
-rw-r--r-- | tests/units/ServiceProvider/ClassProviderTest.php | 21 | ||||
-rw-r--r-- | tests/units/ServiceProvider/FormatterProviderTest.php | 21 |
3 files changed, 43 insertions, 0 deletions
diff --git a/tests/units/Base.php b/tests/units/Base.php index 1b986fcb..1c93e9b8 100644 --- a/tests/units/Base.php +++ b/tests/units/Base.php @@ -47,6 +47,7 @@ abstract class Base extends PHPUnit_Framework_TestCase $this->container->register(new Kanboard\ServiceProvider\RouteProvider()); $this->container->register(new Kanboard\ServiceProvider\AvatarProvider()); $this->container->register(new Kanboard\ServiceProvider\FilterProvider()); + $this->container->register(new Kanboard\ServiceProvider\FormatterProvider()); $this->container->register(new Kanboard\ServiceProvider\JobProvider()); $this->container->register(new Kanboard\ServiceProvider\QueueProvider()); $this->container->register(new Kanboard\ServiceProvider\ExternalTaskProvider()); diff --git a/tests/units/ServiceProvider/ClassProviderTest.php b/tests/units/ServiceProvider/ClassProviderTest.php new file mode 100644 index 00000000..f6528918 --- /dev/null +++ b/tests/units/ServiceProvider/ClassProviderTest.php @@ -0,0 +1,21 @@ +<?php + +use Kanboard\ServiceProvider\ClassProvider; +use Pimple\Container; + +require_once __DIR__.'/../Base.php'; + +class ModelProviderTest extends Base +{ + public function testServiceInstance() + { + $container = new Container(); + $serviceProvider = new ClassProvider($container); + $serviceProvider->register($container); + + $instance1 = $container['userModel']; + $instance2 = $container['userModel']; + + $this->assertSame($instance1, $instance2); + } +} diff --git a/tests/units/ServiceProvider/FormatterProviderTest.php b/tests/units/ServiceProvider/FormatterProviderTest.php new file mode 100644 index 00000000..7984a12b --- /dev/null +++ b/tests/units/ServiceProvider/FormatterProviderTest.php @@ -0,0 +1,21 @@ +<?php + +use Kanboard\ServiceProvider\FormatterProvider; +use Pimple\Container; + +require_once __DIR__.'/../Base.php'; + +class FormatterProviderTest extends Base +{ + public function testServiceInstance() + { + $container = new Container(); + $serviceProvider = new FormatterProvider($container); + $serviceProvider->register($container); + + $instance1 = $container['userAutoCompleteFormatter']; + $instance2 = $container['userAutoCompleteFormatter']; + + $this->assertNotSame($instance1, $instance2); + } +} |