Permalink
Browse files

Rename Mapper\EmailVerification to Mapper\EmailVerification\ZendDb

  • Loading branch information...
1 parent 08dcde9 commit c437e069dc247999374216e2a5fbfd58f48c8b74 @adamlundrigan adamlundrigan committed Oct 24, 2012
View
@@ -48,8 +48,8 @@ public function getServiceConfig()
$obj->setOptions(array('key' => 'email_address'));
return $obj;
},
- 'cdlitwostagesignup_ev_modelmapper' => function($sm) {
- $obj = new Mapper\EmailVerification();
+ 'cdlitwostagesignup_ev_modelmapper_zenddb' => function($sm) {
+ $obj = new Mapper\EmailVerification\ZendDb();
$obj->setDbAdapter($sm->get('zfcuser_zend_db_adapter'));
$obj->setEntityPrototype(new Entity\EmailVerification());
$obj->setHydrator(new Mapper\EmailVerificationHydrator());
View
@@ -1,20 +1,24 @@
<?php
// Generated by ZF2's ./bin/classmap_generator.php
return array(
+ 'CdliTwoStageSignupTest\ServiceConfigurationTest' => __DIR__ . '/tests/CdliTwoStageSignupTest/ServiceConfigurationTest.php',
'CdliTwoStageSignupTest\Service\EmailVerificationTest' => __DIR__ . '/tests/CdliTwoStageSignupTest/Service/EmailVerificationTest.php',
'CdliTwoStageSignupTest\Mapper\EmailVerificationTest' => __DIR__ . '/tests/CdliTwoStageSignupTest/Mapper/EmailVerificationTest.php',
- 'CdliTwoStageSignupTest\Entity\EmailVerificationTest' => __DIR__ . '/tests/CdliTwoStageSignupTest/Entity/EmailVerificationTest.php',
'CdliTwoStageSignupTest\Validator\AssertNoValidationInProgressTest' => __DIR__ . '/tests/CdliTwoStageSignupTest/Validator/AssertNoValidationInProgressTest.php',
- 'CdliTwoStageSignupTest\Framework\TestCase' => __DIR__ . '/tests/CdliTwoStageSignupTest/Framework/TestCase.php',
+ 'CdliTwoStageSignupTest\Entity\EmailVerificationTest' => __DIR__ . '/tests/CdliTwoStageSignupTest/Entity/EmailVerificationTest.php',
'CdliTwoStageSignupTest\Framework\TestCaseOptions' => __DIR__ . '/tests/CdliTwoStageSignupTest/Framework/TestCaseOptions.php',
+ 'CdliTwoStageSignupTest\Framework\TestCase' => __DIR__ . '/tests/CdliTwoStageSignupTest/Framework/TestCase.php',
'CdliTwoStageSignupTest\Framework\MapperTestCase' => __DIR__ . '/tests/CdliTwoStageSignupTest/Framework/MapperTestCase.php',
- 'CdliTwoStageSignupTest\ServiceConfigurationTest' => __DIR__ . '/tests/CdliTwoStageSignupTest/Framework/ServiceConfigurationTest.php',
'CdliTwoStageSignup\Module' => __DIR__ . '/Module.php',
'CdliTwoStageSignup\Controller\RegisterController' => __DIR__ . '/src/CdliTwoStageSignup/Controller/RegisterController.php',
'CdliTwoStageSignup\Service\EmailVerification' => __DIR__ . '/src/CdliTwoStageSignup/Service/EmailVerification.php',
- 'CdliTwoStageSignup\Mapper\EmailVerification' => __DIR__ . '/src/CdliTwoStageSignup/Mapper/EmailVerification.php',
- 'CdliTwoStageSignup\Entity\EmailVerification' => __DIR__ . '/src/CdliTwoStageSignup/Entity/EmailVerification.php',
+ 'CdliTwoStageSignup\Mapper\EmailVerificationHydrator' => __DIR__ . '/src/CdliTwoStageSignup/Mapper/EmailVerificationHydrator.php',
+ 'CdliTwoStageSignup\Mapper\EmailVerification\MapperInterface' => __DIR__ . '/src/CdliTwoStageSignup/Mapper/EmailVerification/MapperInterface.php',
+ 'CdliTwoStageSignup\Mapper\EmailVerification\ZendDb' => __DIR__ . '/src/CdliTwoStageSignup/Mapper/EmailVerification/ZendDb.php',
+ 'CdliTwoStageSignup\Options\ModuleOptions' => __DIR__ . '/src/CdliTwoStageSignup/Options/ModuleOptions.php',
+ 'CdliTwoStageSignup\Options\EmailOptionsInterface' => __DIR__ . '/src/CdliTwoStageSignup/Options/EmailOptionsInterface.php',
'CdliTwoStageSignup\Validator\AssertNoValidationInProgress' => __DIR__ . '/src/CdliTwoStageSignup/Validator/AssertNoValidationInProgress.php',
+ 'CdliTwoStageSignup\Entity\EmailVerification' => __DIR__ . '/src/CdliTwoStageSignup/Entity/EmailVerification.php',
'CdliTwoStageSignup\Form\EmailVerification' => __DIR__ . '/src/CdliTwoStageSignup/Form/EmailVerification.php',
'CdliTwoStageSignup\Form\EmailVerificationFilter' => __DIR__ . '/src/CdliTwoStageSignup/Form/EmailVerificationFilter.php',
-);
+);
@@ -0,0 +1,18 @@
+<?php
+namespace CdliTwoStageSignup\Mapper\EmailVerification;
+
+use CdliTwoStageSignup\Entity\EmailVerification as Model;
+use Zend\Stdlib\Hydrator\HydratorInterface;
+
+interface MapperInterface
+{
+ public function findByEmail($email);
+
+ public function findByRequestKey($key);
+
+ public function cleanExpiredVerificationRequests($expiryTime=86400);
+
+ public function insert($entity, $tableName = null, HydratorInterface $hydrator = null);
+
+ public function remove(Model $evrModel);
+}
@@ -1,12 +1,12 @@
<?php
-namespace CdliTwoStageSignup\Mapper;
+namespace CdliTwoStageSignup\Mapper\EmailVerification;
use ZfcBase\Mapper\AbstractDbMapper;
use CdliTwoStageSignup\Entity\EmailVerification as Model;
use Zend\Db\Sql\Sql;
use Zend\Stdlib\Hydrator\HydratorInterface;
-class EmailVerification extends AbstractDbMapper
+class ZendDb implements MapperInterface extends AbstractDbMapper
{
protected $tableName = 'user_signup_email_verification';
@@ -2,15 +2,15 @@
namespace CdliTwoStageSignup\Service;
-use Zend\Form\Form,
- Zend\EventManager\ListenerAggregate,
- ZfcBase\EventManager\EventProvider,
- CdliTwoStageSignup\Entity\EmailVerification as Model,
- CdliTwoStageSignup\Mapper\EmailVerification as EvrMapper,
- Zend\Mail\Message as EmailMessage,
- Zend\Mail\Transport\TransportInterface as EmailTransport,
- Zend\View\Model\ViewModel,
- Zend\View\Renderer\RendererInterface as ViewRenderer;
+use Zend\Form\Form;
+use Zend\EventManager\ListenerAggregate;
+use ZfcBase\EventManager\EventProvider;
+use CdliTwoStageSignup\Entity\EmailVerification as Model;
+use CdliTwoStageSignup\Mapper\EmailVerification\MapperInterface as EvrMapper;
+use Zend\Mail\Message as EmailMessage;
+use Zend\Mail\Transport\TransportInterface as EmailTransport;
+use Zend\View\Model\ViewModel;
+use Zend\View\Renderer\RendererInterface as ViewRenderer;
use CdliTwoStageSignup\Options\EmailOptionsInterface;
use CdliTwoStageSignup\Form\EmailVerification as EvrForm;
@@ -2,8 +2,8 @@
namespace CdliTwoStageSignup\Validator;
-use Zend\Validator\AbstractValidator,
- CdliTwoStageSignup\Mapper\EmailVerification as EmailVerificationMapper;
+use Zend\Validator\AbstractValidator;
+use CdliTwoStageSignup\Mapper\EmailVerification\MapperInterface as EmailVerificationMapper;
class AssertNoValidationInProgress extends AbstractValidator
{
@@ -2,7 +2,6 @@
namespace CdliTwoStageSignupTest\Mapper;
use CdliTwoStageSignupTest\Framework\MapperTestCase;
-use CdliTwoStageSignup\Mapper\EmailVerification as Mapper;
use CdliTwoStageSignup\Entity\EmailVerification as Entity;
use Zend\Db\Adapter\Adapter as DbAdapter;
@@ -23,7 +23,7 @@ public function setUp()
public function testFindByRequestKey()
{
- $evrMapper = $this->getMock('CdliTwoStageSignup\Mapper\EmailVerification');
+ $evrMapper = $this->getMock('CdliTwoStageSignup\Mapper\EmailVerification\MapperInterface');
$evrMapper->expects($this->once())
->method('findByRequestKey')
->with($this->equalTo('DCE2D890895CF02'))
@@ -37,7 +37,7 @@ public function testFindByRequestKey()
public function testFindByEmail()
{
- $evrMapper = $this->getMock('CdliTwoStageSignup\Mapper\EmailVerification');
+ $evrMapper = $this->getMock('CdliTwoStageSignup\Mapper\EmailVerification\MapperInterface');
$evrMapper->expects($this->once())
->method('findByEmail')
->with($this->equalTo('foo@bar.com'))
@@ -51,7 +51,7 @@ public function testFindByEmail()
public function testCleanExpiredVerificationRequests()
{
- $evrMapper = $this->getMock('CdliTwoStageSignup\Mapper\EmailVerification');
+ $evrMapper = $this->getMock('CdliTwoStageSignup\Mapper\EmailVerification\MapperInterface');
$evrMapper->expects($this->once())
->method('cleanExpiredVerificationRequests')
->with($this->anything())
@@ -64,7 +64,7 @@ public function testCleanExpiredVerificationRequests()
public function testRemove()
{
- $evrMapper = $this->getMock('CdliTwoStageSignup\Mapper\EmailVerification');
+ $evrMapper = $this->getMock('CdliTwoStageSignup\Mapper\EmailVerification\MapperInterface');
$evrMapper->expects($this->once())
->method('remove')
->with($this->model)
@@ -88,7 +88,7 @@ public function testCreateFromForm()
->method('isValid')
->will($this->returnValue(true));
- $evrMapper = $this->getMock('CdliTwoStageSignup\Mapper\EmailVerification');
+ $evrMapper = $this->getMock('CdliTwoStageSignup\Mapper\EmailVerification\MapperInterface');
$evrMapper->expects($this->once())
->method('insert')
->with($this->isInstanceOf('CdliTwoStageSignup\Entity\EmailVerification'))
@@ -20,7 +20,7 @@ public function testMapperFindsNoMatchingRecord()
$this->model->setRequestTime(new \DateTime('2001-01-01T01:01:01'));
$this->model->generateRequestKey();
- $mapper = $this->getMock('CdliTwoStageSignup\Mapper\EmailVerification');
+ $mapper = $this->getMock('CdliTwoStageSignup\Mapper\EmailVerification\MapperInterface');
$mapper->expects($this->once())
->method('findByEmail')
->with($this->equalTo('foo@bar.com'))
@@ -37,7 +37,7 @@ public function testMapperFindsMatchingRecordWhichIsExpired()
$this->model->setRequestTime(new \DateTime('2001-01-01T01:01:01'));
$this->model->generateRequestKey();
- $mapper = $this->getMock('CdliTwoStageSignup\Mapper\EmailVerification');
+ $mapper = $this->getMock('CdliTwoStageSignup\Mapper\EmailVerification\MapperInterface');
$mapper->expects($this->once())
->method('findByEmail')
->with($this->equalTo('foo@bar.com'))
@@ -55,7 +55,7 @@ public function testMapperFindsMatchingRecordWhichIsNotExpired()
$this->model->setRequestTime(new \DateTime('now'));
$this->model->generateRequestKey();
- $mapper = $this->getMock('CdliTwoStageSignup\Mapper\EmailVerification');
+ $mapper = $this->getMock('CdliTwoStageSignup\Mapper\EmailVerification\MapperInterface');
$mapper->expects($this->once())
->method('findByEmail')
->with($this->equalTo('foo@bar.com'))

0 comments on commit c437e06

Please sign in to comment.