[193] r387@phpspec (orig r193): padraic.brady | 2008-01-14 14:03:31 -0700

2 views
Skip to first unread message

nor...@domain51.com

unread,
Jan 14, 2008, 4:03:53 PM1/14/08
to phpspec...@googlegroups.com
Revision
193
Author
phpspec
Date
2008-01-14 14:03:53 -0700 (Mon, 14 Jan 2008)

Log Message

 r387@phpspec (orig r193):  padraic.brady | 2008-01-14 14:03:31 -0700
 Setup for later testing
 

Modified Paths

Added Paths

Property Changed

Diff

Property changes:


Name: svk:merge
   - d6e91ea2-e33a-0410-98df-1d493bd67c58:/:192
   + d6e91ea2-e33a-0410-98df-1d493bd67c58:/:193

Modified: branches/zend/specs/AllSpecs.php (192 => 193)


--- branches/zend/specs/AllSpecs.php	2008-01-13 14:47:55 UTC (rev 192)
+++ branches/zend/specs/AllSpecs.php	2008-01-14 21:03:53 UTC (rev 193)
@@ -1,6 +1,7 @@
 <?php
 
 require_once 'SpecHelper.php';
+require_once 'PHPSpec.php';
 
 $options = new stdClass;
 $options->recursive = true;

Modified: branches/zend/specs/ContextZendSpec.php (192 => 193)


--- branches/zend/specs/ContextZendSpec.php	2008-01-13 14:47:55 UTC (rev 192)
+++ branches/zend/specs/ContextZendSpec.php	2008-01-14 21:03:53 UTC (rev 193)
@@ -14,7 +14,8 @@
     public function itShouldCreateFrontControllerWhenInstantiated()
     {
         $context = new DescribeFooController;
-        $this->spec($context->getFrontController())->should->beAnInstanceOf('Zend_Controller_Front');
+        $this->spec($context->getFrontController())->should
+            ->beAnInstanceOf('Zend_Controller_Front');
     }
 
     public function itShouldAllowSettingControllerManually()
@@ -28,8 +29,49 @@
     {
         $context = new DescribeFooController;
         $context->beforeEach();
-        $this->spec($context->request())->should->beAnInstanceOf('Zend_Controller_Request_http');
+        $this->spec($context->request())->should
+            ->beAnInstanceOf('PHPSpec_Context_Zend_Request');
     }
+
+    public function itShouldAllowSettingModuleDirs()
+    {
+        PHPSpec_Context_Zend::addModuleDirectory('/path/to/module');
+        $this->spec(PHPSpec_Context_Zend::getModuleDirectories())->should
+            ->be(array('/path/to/module'));
+    }
+
+    public function itShouldClearFrontControllerBeforeEachExample()
+    {
+        PHPSpec_Context_Zend::addModuleDirectory(
+            dirname(__FILE__) . DIRECTORY_SEPARATOR . '_modules'
+        );
+        $context = new DescribeFooController;
+        $context->beforeEach();
+        $this->spec(Zend_Controller_Front::getInstance()->getControllerDirectory())
+            ->should->be(
+                array('Default'=>dirname(__FILE__) . DIRECTORY_SEPARATOR
+                . '_modules' . DIRECTORY_SEPARATOR
+                . 'Default' . DIRECTORY_SEPARATOR
+                . 'controllers')
+        );
+    }
+
+    public function itShouldFormulateAndDispatchGetRequest()
+    {
+        PHPSpec_Context_Zend::addModuleDirectory(
+            dirname(__FILE__) . DIRECTORY_SEPARATOR . '_modules'
+        );
+        $context = new DescribeFooController;
+        $context->beforeEach();
+        $context->setController('phpspec');
+        $response = $context->get('pget', array('text', 'hello1'));
+        $this->spec($response)->should->be('hello1');
+    }
+
+    public function after()
+    {
+        PHPSpec_Context_Zend::clearModuleDirectories();
+    }
 }
 
 class DescribeFooController extends PHPSpec_Context_Zend

Added: branches/zend/specs/_modules/Default/controllers/PhpspecController.php (0 => 193)


--- branches/zend/specs/_modules/Default/controllers/PhpspecController.php	                        (rev 0)
+++ branches/zend/specs/_modules/Default/controllers/PhpspecController.php	2008-01-14 21:03:53 UTC (rev 193)
@@ -0,0 +1,13 @@
+<?php
+
+require_once 'Zend/Controller/Action.php';
+
+class PhpspecController extends Zend_Controller_Action
+{
+    public function pgetController()
+    {
+        $this->getResponse()->setBody(
+            $this->getRequest()->text
+        )
+    }
+}
\ No newline at end of file

Added: branches/zend/specs/_modules/controllers/PhpspecController.php (0 => 193)


--- branches/zend/specs/_modules/controllers/PhpspecController.php	                        (rev 0)
+++ branches/zend/specs/_modules/controllers/PhpspecController.php	2008-01-14 21:03:53 UTC (rev 193)
@@ -0,0 +1,13 @@
+<?php
+
+require_once 'Zend/Controller/Action.php';
+
+class PhpspecController extends Zend_Controller_Action
+{
+    public function pgetController()
+    {
+        $this->getResponse()->setBody(
+            $this->getRequest()->text
+        )
+    }
+}
\ No newline at end of file

Added: branches/zend/specs/_zend/.htaccess (0 => 193)


--- branches/zend/specs/_zend/.htaccess	                        (rev 0)
+++ branches/zend/specs/_zend/.htaccess	2008-01-14 21:03:53 UTC (rev 193)
@@ -0,0 +1,2 @@
+RewriteEngine on
+RewriteRule .* index.php
\ No newline at end of file

Added: branches/zend/specs/_zend/application/.htaccess ( => )



Added: branches/zend/specs/_zend/application/controllers/IndexController.php
===================================================================
--- branches/zend/specs/_zend/application/controllers/IndexController.php	                        (rev 0)
+++ branches/zend/specs/_zend/application/controllers/IndexController.php	2008-01-14 21:03:53 UTC (rev 193)
@@ -0,0 +1,11 @@
+<?php
+
+class IndexController extends Zend_Controller_Action
+{
+
+    public function indexAction()
+    {
+        $this->view->text = 'This is Index';
+    }
+
+}
\ No newline at end of file

Added: branches/zend/specs/_zend/application/views/scripts/index/index.phtml (0 => 193)


--- branches/zend/specs/_zend/application/views/scripts/index/index.phtml	                        (rev 0)
+++ branches/zend/specs/_zend/application/views/scripts/index/index.phtml	2008-01-14 21:03:53 UTC (rev 193)
@@ -0,0 +1,8 @@
+<html>
+<head>
+<title>title</title>
+</head>
+<body>
+<p><?php echo $this->escape($this->text); ?></p>
+</body>
+</html>
\ No newline at end of file

Added: branches/zend/specs/_zend/index.php (0 => 193)


--- branches/zend/specs/_zend/index.php	                        (rev 0)
+++ branches/zend/specs/_zend/index.php	2008-01-14 21:03:53 UTC (rev 193)
@@ -0,0 +1,23 @@
+<?php
+
+class Psz_Bootstrap
+{
+
+    public static function bootstrap()
+    {
+        error_reporting(E_ALL|E_STRICT);
+        date_default_timezone_set('Europe/London');
+        // assume Zend Framework on default include_path
+        require_once 'Zend/Framework/Front.php';
+
+        // setup front controller
+        $frontController = Zend_Controller_Front::getInstance();
+        $frontController->throwExceptions(true);
+        $frontController->setControllerDirectory('./application/controllers');
+
+        $frontController->dispatch();
+    }
+
+}
+
+Psz_Bootstrap::bootstrap();
\ No newline at end of file

Added: branches/zend/specs/_zend/public/.htaccess (0 => 193)


--- branches/zend/specs/_zend/public/.htaccess	                        (rev 0)
+++ branches/zend/specs/_zend/public/.htaccess	2008-01-14 21:03:53 UTC (rev 193)
@@ -0,0 +1 @@
+RewriteEngine off
\ No newline at end of file
Reply all
Reply to author
Forward
0 new messages