diff --git a/README.md b/README.md index a7b14d6..18436a5 100644 --- a/README.md +++ b/README.md @@ -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: @@ -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 diff --git a/src/DerpTest/Machinist/Machine.php b/src/DerpTest/Machinist/Machine.php index 204d597..fd60675 100644 --- a/src/DerpTest/Machinist/Machine.php +++ b/src/DerpTest/Machinist/Machine.php @@ -1,7 +1,7 @@ store = $store; $this->table = $table; diff --git a/src/DerpTest/Machinist/Machinist.php b/src/DerpTest/Machinist/Machinist.php index 25c2536..4d311a4 100644 --- a/src/DerpTest/Machinist/Machinist.php +++ b/src/DerpTest/Machinist/Machinist.php @@ -1,7 +1,7 @@ stores[$name] = $store; } @@ -48,7 +48,7 @@ public function addStore(Store $store, $name) /** * @throws \InvalidArgumentException * @param string $name - * @return \DerpTest\Machinist\Store\Store + * @return \DerpTest\Machinist\Store\StoreInterface */ public function getStore($name = 'default') { @@ -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); } diff --git a/src/DerpTest/Machinist/Store/Doctrine.php b/src/DerpTest/Machinist/Store/Doctrine.php index 0ea9fe3..7c0feae 100644 --- a/src/DerpTest/Machinist/Store/Doctrine.php +++ b/src/DerpTest/Machinist/Store/Doctrine.php @@ -9,7 +9,7 @@ * * @author Adam L. Englander */ -class Doctrine implements Store +class Doctrine implements StoreInterface { /** * @var array diff --git a/src/DerpTest/Machinist/Store/SqlStore.php b/src/DerpTest/Machinist/Store/SqlStore.php index 4bf2aa3..35ebd44 100644 --- a/src/DerpTest/Machinist/Store/SqlStore.php +++ b/src/DerpTest/Machinist/Store/SqlStore.php @@ -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; @@ -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) { diff --git a/src/DerpTest/Machinist/Store/Store.php b/src/DerpTest/Machinist/Store/StoreInterface.php similarity index 93% rename from src/DerpTest/Machinist/Store/Store.php rename to src/DerpTest/Machinist/Store/StoreInterface.php index 17a10e4..16e7e64 100644 --- a/src/DerpTest/Machinist/Store/Store.php +++ b/src/DerpTest/Machinist/Store/StoreInterface.php @@ -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 { /** diff --git a/test/DerpTest/Machinist/BlueprintTest.php b/test/DerpTest/Machinist/BlueprintTest.php index cce07b5..ac73b5d 100644 --- a/test/DerpTest/Machinist/BlueprintTest.php +++ b/test/DerpTest/Machinist/BlueprintTest.php @@ -6,7 +6,7 @@ class BlueprintTest extends PHPUnit_Framework_TestCase { /** * @Mock - * @var \DerpTest\Machinist\Store\Store + * @var \DerpTest\Machinist\Store\StoreInterface */ private $store; diff --git a/test/DerpTest/Machinist/MachineTest.php b/test/DerpTest/Machinist/MachineTest.php index 228a2d8..678d251 100644 --- a/test/DerpTest/Machinist/MachineTest.php +++ b/test/DerpTest/Machinist/MachineTest.php @@ -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")); } diff --git a/test/DerpTest/Machinist/MachinistTest.php b/test/DerpTest/Machinist/MachinistTest.php index df375ae..3ae31c7 100644 --- a/test/DerpTest/Machinist/MachinistTest.php +++ b/test/DerpTest/Machinist/MachinistTest.php @@ -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); @@ -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); @@ -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); @@ -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); @@ -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); @@ -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); @@ -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'));