Skip to content

Commit

Permalink
WIP: added service loader to load from config files
Browse files Browse the repository at this point in the history
  • Loading branch information
gr8abbasi committed Oct 9, 2016
1 parent b35b8e7 commit 61cba76
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src/ServiceLoader.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

namespace Gr8abbasi\Container;

/**
* Class ServiceLoader
*
* Loads configuration from different file types
*/
class ServiceLoader
{
/**
* @var array $services
*/
private $services;

/**
* Load Services from config files
* using php file config library
*/
public function loadServices($filePath)
{
/**
* REMOVE ME AND ADD LIBRARY CODE HERE
*/
$this->services = ['hello'];
return $this->services;
}

}
44 changes: 44 additions & 0 deletions tests/ServiceLoaderTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?php

namespace Tests;

use PHPUnit_Framework_TestCase;
use Gr8abbasi\Container\ServiceLoader;

/**
* ServiceLoader Test
*/
class ServiceLoaderTest extends PHPUnit_Framework_TestCase
{
/**
* @var ServiceLoader
*/
public $serviceLoader;

/**
* Setup tests
*/
public function setUp()
{
$this->serviceLoader = new ServiceLoader();
}

/**
* @test
*/
public function isInstanceOfServiceLoader()
{
$this->assertInstanceOf(ServiceLoader::class, $this->serviceLoader);
}

/**
* @test
*/
public function canLoadServicesFromConfigFile()
{
$services = $this->serviceLoader->loadServices('SomeFilePath');

$this->assertNotNull($services);
$this->assertNotEmpty($services);
}
}

0 comments on commit 61cba76

Please sign in to comment.