Skip to content

Commit

Permalink
added new service
Browse files Browse the repository at this point in the history
  • Loading branch information
lalobo committed May 11, 2016
1 parent 3bad9f2 commit 21a2439
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/ServiceProvider/ServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@

use ICanBoogie\Inflector;
use Mooti\Framework\Application\ApplicationRuntime;
use Mooti\Framework\Config\ConfigFactory;

class ServiceProvider implements ServiceProviderInterface
{
const INFLECTOR = 'mooti.framework.inflector';
const APPLICATION_RUNTIME = 'mooti.framework.applicationRuntime';
const CONFIG_FACTORY = 'mooti.framework.configFactory';

/**
* Get the details of the services we are providing
Expand All @@ -19,7 +21,8 @@ public function getServices()
{
return [
self::INFLECTOR => function () { return Inflector::get('en');},
self::APPLICATION_RUNTIME => function () { return new ApplicationRuntime();}
self::APPLICATION_RUNTIME => function () { return new ApplicationRuntime();},
self::CONFIG_FACTORY => function () { return new ConfigFactory();}
];
}
}
4 changes: 4 additions & 0 deletions tests/phpunit/Unit/ServiceProvider/ServiceProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

use Mooti\Framework\ServiceProvider\ServiceProvider;
use ICanBoogie\Inflector;
use Mooti\Framework\Application\ApplicationRuntime;
use Mooti\Framework\Config\ConfigFactory;

class ServiceProviderTest extends \PHPUnit_Framework_TestCase
{
Expand All @@ -16,5 +18,7 @@ public function getServicesSucceeds()

self::assertInternalType('array', $services);
self::assertInstanceOf(Inflector::class, $services[ServiceProvider::INFLECTOR]());
self::assertInstanceOf(ApplicationRuntime::class, $services[ServiceProvider::APPLICATION_RUNTIME]());
self::assertInstanceOf(ConfigFactory::class, $services[ServiceProvider::CONFIG_FACTORY]());
}
}

0 comments on commit 21a2439

Please sign in to comment.