Skip to content

Commit

Permalink
Rename Store to SoteInterface #56
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam Englander committed Sep 27, 2014
1 parent 36ee871 commit 945fbde
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 25 deletions.
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -23,7 +23,7 @@ Configuration of PHP Machinist happens in two steps:
1. Register data stores

Registering data stores is done via either the static `Machinist::store()` method or the
`addStore()` method on a Machinist instance. Both methods take the same parameters, a `Store`
`addStore()` method on a Machinist instance. Both methods take the same parameters, a `StoreInterface`
instance and an optional name for that store. If no name is given, it will default to `default`.
Below is an example of both:

Expand All @@ -45,7 +45,7 @@ Below is an example of both:
2. Define Blueprints

Blueprints are what define the entities in your data store by allowing you to configure the following:
* The `Store` to use when saving or retrieving data for the blueprint
* The `StoreInterface` to use when saving or retrieving data for the blueprint
* The table/collection in which the data will be stored
* The default values for columns/properties in the table/collection. Default values allow you to only
deal with the data that is truly important to your test logic and not waste time and clutter your test code
Expand Down
6 changes: 3 additions & 3 deletions src/DerpTest/Machinist/Machine.php
@@ -1,7 +1,7 @@
<?php
namespace DerpTest\Machinist;

use DerpTest\Machinist\Store\Store;
use DerpTest\Machinist\Store\StoreInterface;

class Machine implements \ArrayAccess, \IteratorAggregate
{
Expand All @@ -21,11 +21,11 @@ class Machine implements \ArrayAccess, \IteratorAggregate
private $data;

/**
* @param Store $store
* @param StoreInterface $store
* @param string $table
* @param array $row_data
*/
public function __construct(Store $store, $table, $row_data)
public function __construct(StoreInterface $store, $table, $row_data)
{
$this->store = $store;
$this->table = $table;
Expand Down
10 changes: 5 additions & 5 deletions src/DerpTest/Machinist/Machinist.php
@@ -1,7 +1,7 @@
<?php
namespace DerpTest\Machinist;

use DerpTest\Machinist\Store\Store;
use DerpTest\Machinist\Store\StoreInterface;

/**
* Do things.. Machinary style.
Expand Down Expand Up @@ -40,15 +40,15 @@ public function getBlueprints()
return $return;
}

public function addStore(Store $store, $name)
public function addStore(StoreInterface $store, $name)
{
$this->stores[$name] = $store;
}

/**
* @throws \InvalidArgumentException
* @param string $name
* @return \DerpTest\Machinist\Store\Store
* @return \DerpTest\Machinist\Store\StoreInterface
*/
public function getStore($name = 'default')
{
Expand Down Expand Up @@ -136,10 +136,10 @@ public static function relationship($bp)

/**
* Add the store with the provided name
* @param Store $store
* @param StoreInterface $store
* @param string $name
*/
public static function store(Store $store, $name = 'default')
public static function store(StoreInterface $store, $name = 'default')
{
self::instance()->addStore($store, $name);
}
Expand Down
2 changes: 1 addition & 1 deletion src/DerpTest/Machinist/Store/Doctrine.php
Expand Up @@ -9,7 +9,7 @@
*
* @author Adam L. Englander <adam.l.englander@gmail.com>
*/
class Doctrine implements Store
class Doctrine implements StoreInterface
{
/**
* @var array
Expand Down
4 changes: 2 additions & 2 deletions src/DerpTest/Machinist/Store/SqlStore.php
Expand Up @@ -5,7 +5,7 @@
* Should provide *most* for the vendor agnostic functionality
* for dealing with an SQL based store.
*/
abstract class SqlStore implements Store
abstract class SqlStore implements StoreInterface
{
protected $pdo;

Expand Down Expand Up @@ -111,7 +111,7 @@ protected function pdo()
* @static
* @throws \InvalidArgumentException
* @param \PDO $pdo
* @return \DerpTest\Machinist\Store\Store
* @return \DerpTest\Machinist\Store\StoreInterface
*/
public static function fromPdo(\PDO $pdo)
{
Expand Down
Expand Up @@ -2,10 +2,10 @@
namespace DerpTest\Machinist\Store;

/**
* Store is the base interface for all drivers providing access to data stores
* regardles of type.
* StoreInterface is the base interface for all drivers providing access to data stores
* regardless of type.
*/
interface Store
interface StoreInterface
{

/**
Expand Down
2 changes: 1 addition & 1 deletion test/DerpTest/Machinist/BlueprintTest.php
Expand Up @@ -6,7 +6,7 @@ class BlueprintTest extends PHPUnit_Framework_TestCase
{
/**
* @Mock
* @var \DerpTest\Machinist\Store\Store
* @var \DerpTest\Machinist\Store\StoreInterface
*/
private $store;

Expand Down
2 changes: 1 addition & 1 deletion test/DerpTest/Machinist/MachineTest.php
Expand Up @@ -9,7 +9,7 @@ class MachineTest extends PHPUnit_Framework_TestCase

public function setUp()
{
$this->store = Phake::mock('\DerpTest\Machinist\Store\Store');
$this->store = Phake::mock('\DerpTest\Machinist\Store\StoreInterface');
$this->machine = new Machine($this->store, 'some_table', array('name' => "awesome"));
}

Expand Down
14 changes: 7 additions & 7 deletions test/DerpTest/Machinist/MachinistTest.php
Expand Up @@ -34,7 +34,7 @@ public function testWipeAllCallsWipeOnAllBlueprints()
$bp1 = Phake::mock('\DerpTest\Machinist\Blueprint');
$bp2 = Phake::mock('\DerpTest\Machinist\Blueprint');
$machinist = Machinist::instance();
$store = Phake::mock('\DerpTest\Machinist\Store\Store');
$store = Phake::mock('\DerpTest\Machinist\Store\StoreInterface');
Machinist::store($store);
$machinist->addBlueprint('bp1', $bp1);
$machinist->addBlueprint('bp2', $bp2);
Expand All @@ -52,7 +52,7 @@ public function testStaticWipeAllCall()
$bp1 = Phake::mock('\DerpTest\Machinist\Blueprint');
$bp2 = Phake::mock('\DerpTest\Machinist\Blueprint');
$machinist = Machinist::instance();
$store = Phake::mock('\DerpTest\Machinist\Store\Store');
$store = Phake::mock('\DerpTest\Machinist\Store\StoreInterface');
Machinist::store($store);
$machinist->addBlueprint('bp1', $bp1);
$machinist->addBlueprint('bp2', $bp2);
Expand All @@ -68,7 +68,7 @@ public function testStaticWipesOne()
$bp1 = Phake::mock('\DerpTest\Machinist\Blueprint');
$bp2 = Phake::mock('\DerpTest\Machinist\Blueprint');
$machinist = Machinist::instance();
$store = Phake::mock('\DerpTest\Machinist\Store\Store');
$store = Phake::mock('\DerpTest\Machinist\Store\StoreInterface');
Machinist::store($store);
$machinist->addBlueprint('bp1', $bp1);
$machinist->addBlueprint('bp2', $bp2);
Expand All @@ -84,7 +84,7 @@ public function testStaticWipeAllCallWithTruncate()
$bp1 = Phake::mock('\DerpTest\Machinist\Blueprint');
$bp2 = Phake::mock('\DerpTest\Machinist\Blueprint');
$machinist = Machinist::instance();
$store = Phake::mock('\DerpTest\Machinist\Store\Store');
$store = Phake::mock('\DerpTest\Machinist\Store\StoreInterface');
Machinist::store($store);
$machinist->addBlueprint('bp1', $bp1);
$machinist->addBlueprint('bp2', $bp2);
Expand All @@ -100,7 +100,7 @@ public function testStaticWipesOneWithTruncate()
$bp1 = Phake::mock('\DerpTest\Machinist\Blueprint');
$bp2 = Phake::mock('\DerpTest\Machinist\Blueprint');
$machinist = Machinist::instance();
$store = Phake::mock('\DerpTest\Machinist\Store\Store');
$store = Phake::mock('\DerpTest\Machinist\Store\StoreInterface');
Machinist::store($store);
$machinist->addBlueprint('bp1', $bp1);
$machinist->addBlueprint('bp2', $bp2);
Expand All @@ -117,7 +117,7 @@ public function testStaticWipeAllButExclude()
$bp2 = Phake::mock('\DerpTest\Machinist\Blueprint');
$bp3 = Phake::mock('\DerpTest\Machinist\Blueprint');
$machinist = Machinist::instance();
$store = Phake::mock('\DerpTest\Machinist\Store\Store');
$store = Phake::mock('\DerpTest\Machinist\Store\StoreInterface');
Machinist::store($store);
$machinist->addBlueprint('bp1', $bp1);
$machinist->addBlueprint('bp2', $bp2);
Expand All @@ -137,7 +137,7 @@ public function testStaticWipeOneAndExcludeErrors()
{
$bp1 = Phake::mock('\DerpTest\Machinist\Blueprint');
$machinist = Machinist::instance();
$store = Phake::mock('\DerpTest\Machinist\Store\Store');
$store = Phake::mock('\DerpTest\Machinist\Store\StoreInterface');
Machinist::store($store);
$machinist->addBlueprint('bp1', $bp1);
Machinist::wipe('bp1', true, array('bp1'));
Expand Down

0 comments on commit 945fbde

Please sign in to comment.