Deprecated: Assigning the return value of new by reference is deprecated in /home/bluestat/public_html/source/index.php on line 477
ViewSVN - Commitdiff - ViewGit - Blue Static

Starting work on ApplicationController

Robert Sesek [2006-04-30 22:30]
Starting work on ApplicationController
diff --git a/docs/phpunit/ApplicationControllerTest.php b/docs/phpunit/ApplicationControllerTest.php
index 9e41dd0..fa51057 100644
--- a/docs/phpunit/ApplicationControllerTest.php
+++ b/docs/phpunit/ApplicationControllerTest.php
@@ -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');
 	}

 	// ###################################################################
diff --git a/includes/ApplicationController.php b/includes/ApplicationController.php
index 23bfb7b..ee78a15 100644
--- a/includes/ApplicationController.php
+++ b/includes/ApplicationController.php
@@ -19,6 +19,64 @@
 || ###################################################################
 \*=====================================================================*/

+/**
+* 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$