Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

We’re showing branches in this repository, but you can also compare across forks.

base fork: Evoke-PHP/Evoke-PHP
base: 4bdeee36be
...
head fork: Evoke-PHP/Evoke-PHP
compare: 0bd4497501
  • 2 commits
  • 29 files changed
  • 0 commit comments
  • 1 contributor
Showing with 251 additions and 134 deletions.
  1. +6 −6 php/src/Evoke/Model/Factory.php
  2. +3 −3 php/src/Evoke/Model/Mapper/DB/DB.php
  3. +5 −5 php/src/Evoke/Model/Mapper/DB/Joint.php
  4. +16 −16 php/src/Evoke/Model/Mapper/DB/JointAdmin.php
  5. +8 −8 php/src/Evoke/Model/Mapper/DB/JointAdminLinked.php
  6. +2 −2 php/src/Evoke/Model/Mapper/DB/Table.php
  7. +2 −2 php/src/Evoke/Model/Mapper/DB/TableAdminTranslation.php
  8. +2 −2 php/src/Evoke/Model/Mapper/DB/Tables.php
  9. +3 −3 php/src/Evoke/Model/Mapper/Session/Session.php
  10. +2 −2 php/src/Evoke/{Persistance → Persistence}/DB/DBIface.php
  11. +2 −2 php/src/Evoke/{Persistance → Persistence}/DB/PDO.php
  12. +2 −2 php/src/Evoke/{Persistance → Persistence}/DB/PDOStatement.php
  13. +5 −5 php/src/Evoke/{Persistance → Persistence}/DB/SQL.php
  14. +2 −2 php/src/Evoke/{Persistance → Persistence}/DB/SQLIface.php
  15. +5 −5 php/src/Evoke/{Persistance → Persistence}/DB/Table/Info.php
  16. +2 −2 php/src/Evoke/{Persistance → Persistence}/DB/Table/InfoIface.php
  17. +8 −8 php/src/Evoke/{Persistance → Persistence}/DB/Table/Joins.php
  18. +2 −2 php/src/Evoke/{Persistance → Persistence}/DB/Table/JoinsIface.php
  19. +5 −5 php/src/Evoke/{Persistance → Persistence}/DB/Table/ListID.php
  20. +2 −2 php/src/Evoke/{Persistance → Persistence}/DB/Table/ListIDIface.php
  21. +1 −1  php/src/Evoke/{Persistance → Persistence}/Filesystem.php
  22. +1 −1  php/src/Evoke/{Persistance → Persistence}/FilesystemIface.php
  23. +2 −2 php/src/Evoke/{Persistance → Persistence}/Session.php
  24. +2 −2 php/src/Evoke/{Persistance → Persistence}/SessionIface.php
  25. +4 −4 php/src/Evoke/{Persistance → Persistence}/SessionManager.php
  26. +2 −2 php/src/Evoke/{Persistance → Persistence}/SessionManagerIface.php
  27. +3 −3 php/src/Evoke/Service/Log/File.php
  28. +12 −8 php/src/Evoke/Service/Provider.php
  29. +140 −27 php/test/unit/Evoke/Service/ProviderTest.php
12 php/src/Evoke/Model/Factory.php
View
@@ -2,7 +2,7 @@
namespace Evoke\Model;
use DomainException,
- Evoke\Persistance\DB\SQLIface,
+ Evoke\Persistence\DB\SQLIface,
Evoke\Service\ProviderIface;
/**
@@ -23,7 +23,7 @@ class Factory implements FactoryIface
/**
* SQL Object.
- * @var Evoke\Persistance\DB\SQLIface
+ * @var Evoke\Persistence\DB\SQLIface
*/
protected $sql;
@@ -102,7 +102,7 @@ public function buildData(/* String */ $tableName = '',
*
* @param mixed[] Parameters for the table info.
*
- * @return Evoke\Persistance\DB\Table\Info
+ * @return Evoke\Persistence\DB\Table\Info
*/
public function buildInfo(Array $params)
{
@@ -112,7 +112,7 @@ public function buildInfo(Array $params)
}
return $this->provider->make(
- 'Evoke\Persistance\DB\Table\Info', $params);
+ 'Evoke\Persistence\DB\Table\Info', $params);
}
/**
@@ -150,7 +150,7 @@ public function buildMapperDBJoint(Array $params)
if (!empty($params['Joins']) && isset($params['Table_Name']))
{
$params['Joins'] = $this->provider->make(
- 'Evoke\Persistance\DB\Table\Joins',
+ 'Evoke\Persistence\DB\Table\Joins',
array('Info' => $this->buildInfo(
array('Table_Name' => $params['Table_Name'])),
'Joins' => $this->buildJoins(
@@ -254,7 +254,7 @@ protected function buildJoins(Array $joins, $tableName)
{
$childTable = $matches[2];
$builtJoins[] = $this->provider->make(
- 'Evoke\Persistance\DB\Table\Joins',
+ 'Evoke\Persistence\DB\Table\Joins',
array('Child_Field' => $matches[3],
'Info' => $this->buildInfo(
array('Table_Name' => $childTable)),
6 php/src/Evoke/Model/Mapper/DB/DB.php
View
@@ -2,7 +2,7 @@
namespace Evoke\Model\Mapper\DB;
use Evoke\Model\Mapper\MapperIface,
- Evoke\Persistance\DB\SQLIface;
+ Evoke\Persistence\DB\SQLIface;
/**
* DB
@@ -18,14 +18,14 @@
{
/**
* SQL Object
- * @var Evoke\Persistance\DB\SQLIface
+ * @var Evoke\Persistence\DB\SQLIface
*/
protected $sql;
/**
* Construct a DB Mapper.
*
- * @param Evoke\Persistance\DB\SQLIface SQL object.
+ * @param Evoke\Persistence\DB\SQLIface SQL object.
*/
public function __construct(SQLIface $sql)
{
10 php/src/Evoke/Model/Mapper/DB/Joint.php
View
@@ -1,8 +1,8 @@
<?php
namespace Evoke\Model\Mapper\DB;
-use Evoke\Persistance\DB\SQLIface,
- Evoke\Persistance\DB\Table\JoinsIface,
+use Evoke\Persistence\DB\SQLIface,
+ Evoke\Persistence\DB\Table\JoinsIface,
InvalidArgumentException;
/**
@@ -23,7 +23,7 @@ class Joint extends DB
* The joins provide the relationships of the data, allowing it to be joint
* together into a meaningful unit of data.
*
- * @var Evoke\Persistance\DB\Table\JoinsIface
+ * @var Evoke\Persistence\DB\Table\JoinsIface
*/
protected $joins;
@@ -42,10 +42,10 @@ class Joint extends DB
/**
* Construct a Mapper for of a joint set of database tables.
*
- * @param Evoke\Persistance\DB\SQLIface
+ * @param Evoke\Persistence\DB\SQLIface
* SQL object.
* @param string The table name where joins start from.
- * @param Evoke\Persistance\DB\Table\JoinsIface
+ * @param Evoke\Persistence\DB\Table\JoinsIface
* Joins object.
* @param mixed[] Select statement settings.
*/
32 php/src/Evoke/Model/Mapper/DB/JointAdmin.php
View
@@ -3,10 +3,10 @@
use Evoke\Message\TreeIface,
Evoke\Model\AdminIface,
- Evoke\Persistance\DB\SQLIface,
- Evoke\Persistance\DB\Table\JoinsIface,
- Evoke\Persistance\DB\Table\ListIDIface,
- Evoke\Persistance\SessionManagerIface,
+ Evoke\Persistence\DB\SQLIface,
+ Evoke\Persistence\DB\Table\JoinsIface,
+ Evoke\Persistence\DB\Table\ListIDIface,
+ Evoke\Persistence\SessionManagerIface,
Exception,
RuntimeException;
@@ -36,26 +36,26 @@ class JointAdmin extends Joint implements AdminIface
/**
* Session Manager
- * @var Evoke\Persistance\SessionManagerIface
+ * @var Evoke\Persistence\SessionManagerIface
*/
protected $sessionManager;
/**
* Database List ID management
- * @var Evoke\Persistance\DB\Table\ListIDIface
+ * @var Evoke\Persistence\DB\Table\ListIDIface
*/
protected $tableListID;
/**
* Construct an Administration Model of a joint set of database tables.
*
- * @param Evoke\Persistance\DB\SQLIface
+ * @param Evoke\Persistence\DB\SQLIface
* SQL object.
* @param string The table name where joins start from.
- * @param Evoke\Persistance\DB\Table\JoinsIface
+ * @param Evoke\Persistence\DB\Table\JoinsIface
* Joins object.
- * @param Evoke\Persistance\SessionManagerIface SessionManager object.
- * @param Evoke\Persistance\DB\Table\ListIDIface
+ * @param Evoke\Persistence\SessionManagerIface SessionManager object.
+ * @param Evoke\Persistence\DB\Table\ListIDIface
* DB List ID Table object.
* @param Evoke\Message\TreeIface
* Failure messages object.
@@ -449,7 +449,7 @@ protected function addEntries(&$data, $join)
* Delete the records for the current table.
*
* @param mixed[] The records to be deleted.
- * @param Evoke\Persistance\DB\Table\JoinsIface The Joins object.
+ * @param Evoke\Persistence\DB\Table\JoinsIface The Joins object.
*/
protected function deleteEntries($data, $join)
{
@@ -492,7 +492,7 @@ protected function deleteEntries($data, $join)
* Order is important when callback functions alter the data they receive.
*
* @param mixed[] The data to traverse.
- * @param Evoke\Persistance\DB\Table\JoinsIface
+ * @param Evoke\Persistence\DB\Table\JoinsIface
* The joins object to traverse the data with.
* @return mixed[] The data after possibly being modified by the callbacks.
*/
@@ -538,7 +538,7 @@ protected function recurse(Array $callbacks,
* Feeback the List_ID from the joint child records into the parent record.
*
* @param mixed[] The parent record.
- * @param Evoke\Persistance\DB\Table\JoinsIface
+ * @param Evoke\Persistence\DB\Table\JoinsIface
* The Join to the child record.
*/
protected function feedbackListID(&$parentRecord, $join)
@@ -568,7 +568,7 @@ protected function feedbackListID(&$parentRecord, $join)
* Validate all of the data specified with the Joins.
*
* @param mixed[] The data to validate.
- * @param Evoke\Persistance\DB\Table\JoinsIface
+ * @param Evoke\Persistence\DB\Table\JoinsIface
* The Joins object to validate the data with.
* @return bool Whether the data is valid or not.
*/
@@ -586,7 +586,7 @@ protected function validate($data, JoinsIface $joins)
* Validate the entries for the table.
*
* @param mixed[] The data for the table.
- * @param Evoke\Persistance\DB\Table\JoinsIface The join for the data.
+ * @param Evoke\Persistence\DB\Table\JoinsIface The join for the data.
*/
protected function validateEntries(Array $data,
JoinsIface $join)
@@ -625,7 +625,7 @@ protected function validateEntries(Array $data,
* @param mixed[] The array of callbacks that we are calling from.
* @param string Index for the callback that we want to call.
* @param mixed[] The data to pass to the callback by reference.
- * @param Evoke\Persistance\DB\Table\JoinsIface
+ * @param Evoke\Persistence\DB\Table\JoinsIface
* The Joins object to pass to the callback.
*/
private function call(Array $callbacks, $cb, Array &$data, $joins)
16 php/src/Evoke/Model/Mapper/DB/JointAdminLinked.php
View
@@ -2,10 +2,10 @@
namespace Evoke\Model\Mapper\DB;
use Evoke\Message\TreeIface,
- Evoke\Persistance\DB\SQLIface,
- Evoke\Persistance\DB\Table\JoinsIface,
- Evoke\Persistance\DB\Table\ListIDIface,
- Evoke\Persistance\SessionManagerIface;
+ Evoke\Persistence\DB\SQLIface,
+ Evoke\Persistence\DB\Table\JoinsIface,
+ Evoke\Persistence\DB\Table\ListIDIface,
+ Evoke\Persistence\SessionManagerIface;
/**
* JointAdminLinked
*
@@ -46,14 +46,14 @@ class JointAdminLinked extends JointAdmin
/** Construct an Administration Model of a joint set of database tables with
* linked information in the filesystem.
- * @param Evoke\Persistance\DB\SQLIface
+ * @param Evoke\Persistence\DB\SQLIface
* SQL object.
* @param string Table name where joins start from.
- * @param Evoke\Persistance\DB\Table\JoinsIface
+ * @param Evoke\Persistence\DB\Table\JoinsIface
* Joins object.
- * @param Evoke\Persistance\SessionManagerIface
+ * @param Evoke\Persistence\SessionManagerIface
* SessionManager object.
- * @param Evoke\Persistance\DB\Table\ListIDIface
+ * @param Evoke\Persistence\DB\Table\ListIDIface
* DB List ID Table object.
* @param Evoke\Message\TreeIface
* Failure messages object.
4 php/src/Evoke/Model/Mapper/DB/Table.php
View
@@ -1,7 +1,7 @@
<?php
namespace Evoke\Model\Mapper\DB;
-use Evoke\Persistance\DB\SQLIface,
+use Evoke\Persistence\DB\SQLIface,
InvalidArgumentException;
/**
@@ -30,7 +30,7 @@ class Table extends DB
/** Construct a mapper for a database table.
*
- * @param Evoke\Persistance\DB\SQLIface
+ * @param Evoke\Persistence\DB\SQLIface
* SQL object.
* @param string The database table that the model represents.
* @param mixed[] Select statement settings.
4 php/src/Evoke/Model/Mapper/DB/TableAdminTranslation.php
View
@@ -1,8 +1,8 @@
<?php
namespace Evoke\Model\Mapper\DB;
-use Evoke\Persistance\DB\SQLIface,
- Evoke\Persistance\FilesystemIface,
+use Evoke\Persistence\DB\SQLIface,
+ Evoke\Persistence\FilesystemIface,
Exception,
InvalidArgumentException;
4 php/src/Evoke/Model/Mapper/DB/Tables.php
View
@@ -1,7 +1,7 @@
<?php
namespace Evoke\Model\Mapper\DB;
-use Evoke\Persistance\DB\SQLIface;
+use Evoke\Persistence\DB\SQLIface;
/**
* Tables Mapper
@@ -30,7 +30,7 @@ class Tables extends DB
/**
* Construct a model for a list of database tables.
*
- * @param Evoke\Persistance\DB\SQLIface
+ * @param Evoke\Persistence\DB\SQLIface
* SQL object.
* @param mixed[] Extra tables to list.
* @param mixed[] Tables to ignore for the list.
6 php/src/Evoke/Model/Mapper/Session/Session.php
View
@@ -2,7 +2,7 @@
namespace Evoke\Model\Mapper\Session;
use Evoke\Model\Mapper\MapperIface,
- Evoke\Persistance\SessionManagerIface;
+ Evoke\Persistence\SessionManagerIface;
/**
* Session Mapper
@@ -16,14 +16,14 @@ class Session implements MapperIface
{
/**
* Session Manager
- * @var Evoke\Persistance\SessionManagerIface
+ * @var Evoke\Persistence\SessionManagerIface
*/
protected $sessionManager;
/**
* Construct a Session Mapper.
*
- * @param Evoke\Persistance\SessionManagerIfaceSessionManager
+ * @param Evoke\Persistence\SessionManagerIfaceSessionManager
* The Session Manager for the part of the session we are mapping.
*/
public function __construct(SessionManagerIface $sessionManager)
4 php/src/Evoke/Persistance/DB/DBIface.php → php/src/Evoke/Persistence/DB/DBIface.php
View
@@ -1,5 +1,5 @@
<?php
-namespace Evoke\Persistance\DB;
+namespace Evoke\Persistence\DB;
/**
* DBIface
@@ -10,7 +10,7 @@
* @author Paul Young <evoke@youngish.homelinux.org>
* @copyright Copyright (c) 2012 Paul Young
* @license MIT
- * @package Persistance
+ * @package Persistence
*/
interface DBIface
{
4 php/src/Evoke/Persistance/DB/PDO.php → php/src/Evoke/Persistence/DB/PDO.php
View
@@ -1,5 +1,5 @@
<?php
-namespace Evoke\Persistance\DB;
+namespace Evoke\Persistence\DB;
use InvalidArgumentException;
@@ -11,7 +11,7 @@
* @author Paul Young <evoke@youngish.homelinux.org>
* @copyright Copyright (c) 2012 Paul Young
* @license MIT
- * @package Persistance
+ * @package Persistence
*/
class PDO extends \PDO implements DBIface
{
4 php/src/Evoke/Persistance/DB/PDOStatement.php → php/src/Evoke/Persistence/DB/PDOStatement.php
View
@@ -1,5 +1,5 @@
<?php
-namespace Evoke\Persistance\DB;
+namespace Evoke\Persistence\DB;
use Evoke\Message\Exception\DB as ExceptionDB,
Exception;
@@ -10,7 +10,7 @@
* @author Paul Young <evoke@youngish.homelinux.org>
* @copyright Copyright (c) 2012 Paul Young
* @license MIT
- * @package Persistance
+ * @package Persistence
*/
class PDOStatement extends \PDOStatement
{
10 php/src/Evoke/Persistance/DB/SQL.php → php/src/Evoke/Persistence/DB/SQL.php
View
@@ -1,5 +1,5 @@
<?php
-namespace Evoke\Persistance\DB;
+namespace Evoke\Persistence\DB;
use Evoke\Message\Exception\DB as ExceptionDB,
Exception;
@@ -24,13 +24,13 @@
* @author Paul Young <evoke@youngish.homelinux.org>
* @copyright Copyright (c) 2012 Paul Young
* @license MIT
- * @package Persistance
+ * @package Persistence
*/
class SQL implements SQLIface
{
/**
* Database object.
- * @var Evoke\Persistance\DB\DBIface
+ * @var Evoke\Persistence\DB\DBIface
*/
protected $db;
@@ -49,12 +49,12 @@ class SQL implements SQLIface
/**
* Construct an SQL object.
*
- * @param Evoke\Persistance\DB\DBIface
+ * @param Evoke\Persistence\DB\DBIface
* Database object to perform the SQL on.
*/
public function __construct(
DBIface $database,
- /* String */ $statementClass = 'Evoke\Persistance\DB\PDOStatement')
+ /* String */ $statementClass = 'Evoke\Persistence\DB\PDOStatement')
{
$this->db = $database;
$this->statementClass = $statementClass;
4 php/src/Evoke/Persistance/DB/SQLIface.php → php/src/Evoke/Persistence/DB/SQLIface.php
View
@@ -1,5 +1,5 @@
<?php
-namespace Evoke\Persistance\DB;
+namespace Evoke\Persistence\DB;
/**
* SQLIface
@@ -7,7 +7,7 @@
* @author Paul Young <evoke@youngish.homelinux.org>
* @copyright Copyright (c) 2012 Paul Young
* @license MIT
- * @package Persistance
+ * @package Persistence
*/
interface SQLIface extends DBIface
{
10 php/src/Evoke/Persistance/DB/Table/Info.php → php/src/Evoke/Persistence/DB/Table/Info.php
View
@@ -1,8 +1,8 @@
<?php
-namespace Evoke\Persistance\DB\Table;
+namespace Evoke\Persistence\DB\Table;
use Evoke\Message\TreeIface,
- Evoke\Persistance\DB\SQLIface,
+ Evoke\Persistence\DB\SQLIface,
InvalidArgumentException,
OutOfRangeException;
@@ -14,7 +14,7 @@
* @author Paul Young <evoke@youngish.homelinux.org>
* @copyright Copyright (c) 2012 Paul Young
* @license MIT
- * @package Persistance
+ * @package Persistence
*/
class Info implements InfoIface
{
@@ -56,7 +56,7 @@ class Info implements InfoIface
/**
* SQL object.
- * @var Evoke\Persistance\DB\SQLIface
+ * @var Evoke\Persistence\DB\SQLIface
*/
protected $sql;
@@ -69,7 +69,7 @@ class Info implements InfoIface
/**
* Construct a Table Info object.
*
- * @param Evoke\Persistance\DB\SQLIface SQL object.
+ * @param Evoke\Persistence\DB\SQLIface SQL object.
* @param string Table Name.
* @param Evoke\Message\TreeIface Failures.
*/
4 php/src/Evoke/Persistance/DB/Table/InfoIface.php → php/src/Evoke/Persistence/DB/Table/InfoIface.php
View
@@ -1,5 +1,5 @@
<?php
-namespace Evoke\Persistance\DB\Table;
+namespace Evoke\Persistence\DB\Table;
/**
* InfoIface
@@ -7,7 +7,7 @@
* @author Paul Young <evoke@youngish.homelinux.org>
* @copyright Copyright (c) 2012 Paul Young
* @license MIT
- * @package Persistance
+ * @package Persistence
*/
interface InfoIface extends \Evoke\Service\ValiditionIface
{
16 php/src/Evoke/Persistance/DB/Table/Joins.php → php/src/Evoke/Persistence/DB/Table/Joins.php
View
@@ -1,5 +1,5 @@
<?php
-namespace Evoke\Persistance\DB\Table;
+namespace Evoke\Persistence\DB\Table;
use InvalidArgumentException;
@@ -58,7 +58,7 @@
* @author Paul Young <evoke@youngish.homelinux.org>
* @copyright Copyright (c) 2012 Paul Young
* @license MIT
- * @package Persistance
+ * @package Persistence
*/
class Joins implements JoinsIface
{
@@ -96,7 +96,7 @@ class Joins implements JoinsIface
/**
* Database Table Info
- * @var Evoke\Persistance\DB\Table\InfoIface
+ * @var Evoke\Persistence\DB\Table\InfoIface
*/
protected $info;
@@ -109,7 +109,7 @@ class Joins implements JoinsIface
/**
* Array ofJoin objects from this node to other Join objects in the join
* tree.
- * @var Evoke\Persistance\DB\Table\JoinsIface[]
+ * @var Evoke\Persistence\DB\Table\JoinsIface[]
*/
protected $joins;
@@ -149,12 +149,12 @@ class Joins implements JoinsIface
/**
* Construct the Joins object.
*
- * @param Evoke\Persistance\DB\Table\InfoIface
+ * @param Evoke\Persistence\DB\Table\InfoIface
* DB Table Info object.
* @param string Table Name.
* @param string Parent Field.
* @param string Child Field.
- * @param Evoke\Persistance\DB\Table\JoinsIface[]
+ * @param Evoke\Persistence\DB\Table\JoinsIface[]
* Joins from this node.
* @param string Admin Managed.
* @param string Compare Type.
@@ -349,7 +349,7 @@ public function getFailures()
/**
* Get the joins.
*
- * @return Evoke\Persistance\DB\Table\JoinsIface[]
+ * @return Evoke\Persistence\DB\Table\JoinsIface[]
*/
public function getJoins()
{
@@ -528,7 +528,7 @@ protected function getRowID($row)
/**
* Build the join from the join components.
*
- * @param Evoke\Persistance\DB\Table\JoinsIface
+ * @param Evoke\Persistence\DB\Table\JoinsIface
*
* @return string
*/
4 php/src/Evoke/Persistance/DB/Table/JoinsIface.php → php/src/Evoke/Persistence/DB/Table/JoinsIface.php
View
@@ -1,5 +1,5 @@
<?php
-namespace Evoke\Persistance\DB\Table;
+namespace Evoke\Persistence\DB\Table;
/**
* JoinsIface
@@ -7,7 +7,7 @@
* @author Paul Young <evoke@youngish.homelinux.org>
* @copyright Copyright (c) 2012 Paul Young
* @license MIT
- * @package Persistance
+ * @package Persistence
*/
interface JoinsIface
{
10 php/src/Evoke/Persistance/DB/Table/ListID.php → php/src/Evoke/Persistence/DB/Table/ListID.php
View
@@ -1,8 +1,8 @@
<?php
-namespace Evoke\Persistance\DB\Table;
+namespace Evoke\Persistence\DB\Table;
use Evoke\Message\Exception\DB as ExceptionDB,
- Evoke\Persistance\DB\SQLIface,
+ Evoke\Persistence\DB\SQLIface,
Exception,
LogicException;
@@ -12,7 +12,7 @@
* @author Paul Young <evoke@youngish.homelinux.org>
* @copyright Copyright (c) 2012 Paul Young
* @license MIT
- * @package Persistance
+ * @package Persistence
*/
class ListID
{
@@ -30,14 +30,14 @@ class ListID
/**
* SQL object.
- * @var Evoke\Persistance\DB\SQLIface
+ * @var Evoke\Persistence\DB\SQLIface
*/
protected $sql;
/**
* Construct a List ID object.
*
- * @param Evoke\Persistance\DB\SQLIface
+ * @param Evoke\Persistence\DB\SQLIface
* SQL object.
* @param string[] Fields used in the List ID table.
* @param string The table name of the List ID table.
4 php/src/Evoke/Persistance/DB/Table/ListIDIface.php → php/src/Evoke/Persistence/DB/Table/ListIDIface.php
View
@@ -1,5 +1,5 @@
<?php
-namespace Evoke\Persistance\DB\Table;
+namespace Evoke\Persistence\DB\Table;
/**
* ListIDIface
@@ -7,7 +7,7 @@
* @author Paul Young <evoke@youngish.homelinux.org>
* @copyright Copyright (c) 2012 Paul Young
* @license MIT
- * @package Persistance
+ * @package Persistence
*/
interface ListIDIface
{
2  php/src/Evoke/Persistance/Filesystem.php → php/src/Evoke/Persistence/Filesystem.php
View
@@ -1,5 +1,5 @@
<?php
-namespace Evoke\Persistance;
+namespace Evoke\Persistence;
use FilesystemIterator,
RecursiveDirectoryIterator,
2  php/src/Evoke/Persistance/FilesystemIface.php → php/src/Evoke/Persistence/FilesystemIface.php
View
@@ -1,5 +1,5 @@
<?php
-namespace Evoke\Persistance;
+namespace Evoke\Persistence;
interface FilesystemIface
{
4 php/src/Evoke/Persistance/Session.php → php/src/Evoke/Persistence/Session.php
View
@@ -1,5 +1,5 @@
<?php
-namespace Evoke\Persistance;
+namespace Evoke\Persistence;
use RuntimeException;
@@ -9,7 +9,7 @@
* @author Paul Young <evoke@youngish.homelinux.org>
* @copyright Copyright (c) 2012 Paul Young
* @license MIT
- * @package Persistance
+ * @package Persistence
*/
class Session implements SessionIface
{
4 php/src/Evoke/Persistance/SessionIface.php → php/src/Evoke/Persistence/SessionIface.php
View
@@ -1,5 +1,5 @@
<?php
-namespace Evoke\Persistance;
+namespace Evoke\Persistence;
/**
* SessionIface
@@ -7,7 +7,7 @@
* @author Paul Young <evoke@youngish.homelinux.org>
* @copyright Copyright (c) 2012 Paul Young
* @license MIT
- * @package Persistance
+ * @package Persistence
*/
interface SessionIface
{
8 php/src/Evoke/Persistance/SessionManager.php → php/src/Evoke/Persistence/SessionManager.php
View
@@ -1,5 +1,5 @@
<?php
-namespace Evoke\Persistance;
+namespace Evoke\Persistence;
/**
* SessionManager
@@ -9,7 +9,7 @@
* @author Paul Young <evoke@youngish.homelinux.org>
* @copyright Copyright (c) 2012 Paul Young
* @license MIT
- * @package Persistance
+ * @package Persistence
*/
class SessionManager implements SessionManagerIface
{
@@ -25,14 +25,14 @@ class SessionManager implements SessionManagerIface
/**
* Session object.
- * @var Evoke\Persistance\SessionIface
+ * @var Evoke\Persistence\SessionIface
*/
protected $session;
/**
* Construct a Session Manager object.
*
- * @param Evoke\Persistance\SessionIface Session
+ * @param Evoke\Persistence\SessionIface Session
* @param string[] Domain to manage.
*/
public function __construct(SessionIface $session,
4 php/src/Evoke/Persistance/SessionManagerIface.php → php/src/Evoke/Persistence/SessionManagerIface.php
View
@@ -1,5 +1,5 @@
<?php
-namespace Evoke\Persistance;
+namespace Evoke\Persistence;
/**
* SessionManagerIface
@@ -7,7 +7,7 @@
* @author Paul Young <evoke@youngish.homelinux.org>
* @copyright Copyright (c) 2012 Paul Young
* @license MIT
- * @package Persistance
+ * @package Persistence
*/
interface SessionManagerIface
{
6 php/src/Evoke/Service/Log/File.php
View
@@ -2,7 +2,7 @@
namespace Evoke\Service\Log;
use DateTime,
- Evoke\Persistance\FilesystemIface,
+ Evoke\Persistence\FilesystemIface,
InvalidArgumentException;
/**
@@ -47,7 +47,7 @@ class File implements LoggerIface
/**
* Filesystem
- * @var Evoke\Persistance\FilesystemIface
+ * @var Evoke\Persistence\FilesystemIface
*/
protected $filesystem;
@@ -66,7 +66,7 @@ class File implements LoggerIface
/**
* Construct a File Logger object.
*
- * @param Evoke\Persistance\FilesystemIface
+ * @param Evoke\Persistence\FilesystemIface
* Filesystem object
* @param bool Whether to append to the file.
* @param int(octal) The directory mode for the log file.
20 php/src/Evoke/Service/Provider.php
View
@@ -153,11 +153,19 @@ protected function getDependency(ReflectionParameter $reflectionParam,
return $passedParameters[$reflectionParam->name];
}
+ /* As far as I can tell the difference between isDefaultValueAvailable
+ * and isOptional is that:
+ * isDefaultValueAvailable is for classes in PHP
+ * isOptional is for builtin objects from the PHP engine
+ */
if ($reflectionParam->isDefaultValueAvailable())
{
- // Use a default value.
return $reflectionParam->getDefaultValue();
}
+ elseif ($reflectionParam->isOptional())
+ {
+ return null;
+ }
$depClass = $reflectionParam->getClass();
@@ -165,7 +173,7 @@ protected function getDependency(ReflectionParameter $reflectionParam,
{
$message = 'Missing ';
$message .= $reflectionParam->isArray() ? 'Array' : 'Scalar';
- $message .= ' dependency.';
+ $message .= ' Dependency';
// It must be an unset Scalar or Array. Bail hard and early.
throw new InvalidArgumentException($message);
@@ -177,12 +185,8 @@ protected function getDependency(ReflectionParameter $reflectionParam,
return $this->make($depClass->name);
}
- if ($reflectionParam->isOptional())
- {
- return null;
- }
-
- throw new InvalidArgumentException('Missing Interface Dependency');
+ throw new InvalidArgumentException(
+ 'Missing Abstract/Interface Dependency');
}
/**
167 php/test/unit/Evoke/Service/ProviderTest.php
View
@@ -5,33 +5,6 @@
Evoke\Service\Provider,
PHPUnit_Framework_TestCase;
-// Interface for the test.
-interface PI
-{
-
-}
-
-// Classes for the test.
-class PA
-{
- // No constructor means no dependencies.
-}
-
-class PB
-{
- public function __construct(PI $paramOne, Array $arr) {}
-}
-
-class PC implements PI
-{
- public function __construct($int, $strDefault = 'Paul') {}
-}
-
-class PD
-{
- public function __construct(PA $concrete, PI $interface) {}
-}
-
/**
* Provider Test.
*/
@@ -64,6 +37,113 @@ public function testMake($object, $classname, $params)
$this->assertInstanceOf($classname, $object->make($classname, $params));
}
+ /**
+ * Trying to make an object with a missing Abstract/Interface throws IAE.
+ *
+ * @covers Evoke\Service\Provider::getDependency
+ * @depends Evoke_Test\Service\ProviderTest::test__construct
+ * @expectedException InvalidArgumentException
+ * @expectedExceptionMessage Missing Abstract/Interface Dependency
+ */
+ public function testMissingDependencyAbstractInterface()
+ {
+ $object = new Provider($this->getMock('Evoke\Service\CacheIface'));
+ $object->make('Evoke_Test\Service\PD');
+ }
+
+ /**
+ * Trying to make an object with a missing Array throws IAE.
+ *
+ * @covers Evoke\Service\Provider::getDependency
+ * @depends Evoke_Test\Service\ProviderTest::test__construct
+ * @expectedException InvalidArgumentException
+ * @expectedExceptionMessage Missing Array Dependency
+ */
+ public function testMissingDependencyArray()
+ {
+ $object = new Provider($this->getMock('Evoke\Service\CacheIface'));
+ $object->make('Evoke_Test\Service\PB',
+ array('Param_One' => $this->getMock(
+ 'Evoke_Test\Service\PC', NULL, array(1))));
+ }
+
+ /**
+ * Trying to make an object with a missing scalar throws IAE.
+ *
+ * @covers Evoke\Service\Provider::getDependency
+ * @depends Evoke_Test\Service\ProviderTest::test__construct
+ * @expectedException InvalidArgumentException
+ * @expectedExceptionMessage Missing Scalar Dependency
+ */
+ public function testMissingDependencyScalar()
+ {
+ $object = new Provider($this->getMock('Evoke\Service\CacheIface'));
+ $object->make('Evoke_Test\Service\PC');
+ }
+
+ /**
+ * Test that the reflection cache is set when it is fresh.
+ *
+ * @covers Evoke\Service\Provider::getReflection
+ * @depends Evoke_Test\Service\ProviderTest::test__construct
+ */
+ public function testReflectionCacheFresh()
+ {
+ $cache = $this->getMock('Evoke\Service\CacheIface');
+
+ $i = 0;
+ $cache->expects($this->at($i++))
+ ->method('exists')
+ ->with($this->equalTo('Evoke_Test\Service\PD'))
+ ->will($this->returnValue(false));
+
+ $cache->expects($this->at($i++))
+ ->method('set')
+ ->with($this->equalTo('Evoke_Test\Service\PD'),
+ $this->arrayHasKey('Class'));
+
+
+ $object = new Provider($cache);
+ $object->make('Evoke_Test\Service\PD',
+ array('Interface' => $this->getMock(
+ 'Evoke_Test\Service\PC', NULL, array(1))));
+ }
+
+ /**
+ * Test that the reflection cache is used when it has information.
+ *
+ * @covers Evoke\Service\Provider::getReflection
+ * @depends Evoke_Test\Service\ProviderTest::test__construct
+ */
+ public function testReflectionCacheUsed()
+ {
+ // Now simulate the cache being used.
+ $usedCache = $this->getMock('Evoke\Service\CacheIface');
+
+ $i = 0;
+ $usedCache->expects($this->at($i++))
+ ->method('exists')
+ ->with($this->equalTo('Evoke_Test\Service\PD'))
+ ->will($this->returnValue(true));
+
+ $pdClass = new \ReflectionClass('Evoke_Test\Service\PD');
+ $pdParams = $pdClass->getConstructor()->getParameters();
+
+ $usedCache->expects($this->at($i++))
+ ->method('get')
+ ->with($this->equalTo('Evoke_Test\Service\PD'))
+ ->will($this->returnValue(
+ array('Class' => $pdClass,
+ 'Params' => $pdParams)));
+
+ $object = new Provider($usedCache);
+ $this->assertInstanceOf(
+ 'Evoke_Test\Service\PD',
+ $object->make('Evoke_Test\Service\PD',
+ array('Interface' => $this->getMock(
+ 'Evoke_Test\Service\PC', NULL, array(1)))));
+ }
+
/******************/
/* Data Providers */
/******************/
@@ -99,9 +179,42 @@ public function providerMake()
'Classname' => 'Evoke_Test\Service\PD',
'Params' => array('Interface' => $this->getMock(
'Evoke_Test\Service\PC', NULL, array(1))));
+
+ $tests['Built_In_Class'] = array(
+ 'Object' => new Provider($this->getMock('Evoke\Service\Cache')),
+ 'Classname' => 'DateTime',
+ 'Params' => array());
return $tests;
}
}
+// Interface for the test.
+interface PI
+{
+
+}
+
+// Classes for the test.
+class PA
+{
+ // No constructor means no dependencies.
+}
+
+class PB
+{
+ public function __construct(PI $paramOne, Array $arr) {}
+}
+
+class PC implements PI
+{
+ public function __construct($int, $strDefault = 'Paul') {}
+}
+
+class PD
+{
+ public function __construct(PA $concrete, PI $interface) {}
+}
+
+
// EOF

No commit comments for this range

Something went wrong with that request. Please try again.