From 36d4fac8c0ba93ad3cbd0406cebf694d7147e6e8 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sun, 30 Apr 2006 22:30:13 +0000 Subject: [PATCH] Starting work on ApplicationController --- docs/phpunit/ApplicationControllerTest.php | 24 ++++++++- includes/ApplicationController.php | 58 ++++++++++++++++++++++ 2 files changed, 80 insertions(+), 2 deletions(-) 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$ -- 2.43.5