Starting work on ApplicationController
authorRobert Sesek <rsesek@bluestatic.org>
Sun, 30 Apr 2006 22:30:13 +0000 (22:30 +0000)
committerRobert Sesek <rsesek@bluestatic.org>
Sun, 30 Apr 2006 22:30:13 +0000 (22:30 +0000)
docs/phpunit/ApplicationControllerTest.php
includes/ApplicationController.php

index 9e41dd0c2079f533135dceeef32ca488d889af6b..fa5105720d5c94f38f3db62c207db84de4b2eca5 100644 (file)
@@ -18,9 +18,28 @@ require_once('./../../includes/ApplicationController.php');
 */
 class ApplicationControllerTest extends PHPUnit2_Framework_TestCase
 {
+       /**
+       * Internal fixture: an instance of ApplicationController
+       * @var  object
+       */
        protected $fixture;
        
-       public function setUp() {}
+       /**
+       * Repository path
+       * @var  string
+       */
+       private $reposPath = 'file:///Server/htdocs/viewsvn/reposdir';
+       
+       /**
+       * Binary path
+       * @var  string
+       */
+       private $binaryPath = '/usr/local/bin/svn';
+       
+       public function setUp()
+       {
+               $this->fixture = new ApplicationController($this->binaryPath, $this->reposPath);
+       }
        
        // ###################################################################
        /**
@@ -48,7 +67,8 @@ class ApplicationControllerTest extends PHPUnit2_Framework_TestCase
        */
        public function testGetRepositoryUri()
        {
-               throw new PHPUnit2_Framework_IncompleteTestError;
+               $this->assertEquals($this->reposPath, $this->fixture->getRepositoryPath(), 'Repository path is empty');
+               $this->assertRegExp('#(.*)/$#', $this->fixture->getRepositoryPath(), 'Repository path does not end with a slash');
        }
        
        // ###################################################################
index 23bfb7b2f844b2640253089606726172aa98df92..ee78a155f3b5915ab2d75baae29777c4e9ad8fea 100644 (file)
 || ###################################################################
 \*=====================================================================*/
 
+/**
+* ApplicationController
+*
+* This is the main class that is responsible for routing requests, storing
+* common variables, and managing the backend of the application. It does
+* not, however, deal in processing data.
+*
+* @author              Iris Studios, Inc.
+* @copyright   Copyright ©2002 - [#]year[#], Iris Studios, Inc.
+* @version             $Revision$
+* @package             ViewSVN
+* 
+*/
+class ApplicationController
+{
+       /**
+       * Subversion binary path
+       * @var  string
+       */
+       private $binaryPath;
+       
+       /**
+       * Repository name
+       * @var  string
+       */
+       private $reposName;
+       
+       /**
+       * Repository path
+       * @var  string
+       */
+       private $reposPath;
+       
+       // ###################################################################
+       /**
+       * Constructor: setup fields
+       *
+       * @param        string  SVN binary path
+       * @param        string  Repository path
+       */
+       public function __construct($binaryPath, $reposPath)
+       {
+               $this->reposPath = $reposPath;
+               $this->binaryPath = $binaryPath;
+       }
+       
+       // ###################################################################
+       /**
+       * Returns the repository path ($reposPath) variable
+       *
+       * @return       string  The active repository path
+       */
+       public function getRepositoryPath()
+       {
+               return $this->reposPath;
+       }
+}
+
 /*=====================================================================*\
 || ###################################################################
 || # $HeadURL$