wact-cvs Mailing List for Web Application Component Toolkit
Status: Pre-Alpha
Brought to you by:
jeffmoore
You can subscribe to this list here.
| 2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(126) |
Oct
(478) |
Nov
(263) |
Dec
(211) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2004 |
Jan
(50) |
Feb
(370) |
Mar
(549) |
Apr
(44) |
May
(152) |
Jun
(610) |
Jul
(270) |
Aug
(16) |
Sep
(4) |
Oct
(19) |
Nov
(359) |
Dec
(235) |
| 2005 |
Jan
(19) |
Feb
(75) |
Mar
(24) |
Apr
(44) |
May
|
Jun
(3) |
Jul
|
Aug
(90) |
Sep
(64) |
Oct
(305) |
Nov
(95) |
Dec
(98) |
| 2006 |
Jan
(97) |
Feb
(94) |
Mar
(79) |
Apr
(30) |
May
(49) |
Jun
(23) |
Jul
|
Aug
|
Sep
(4) |
Oct
(68) |
Nov
(37) |
Dec
(62) |
| 2007 |
Jan
(9) |
Feb
(1) |
Mar
(50) |
Apr
(70) |
May
(19) |
Jun
(14) |
Jul
(19) |
Aug
(20) |
Sep
|
Oct
(53) |
Nov
(9) |
Dec
(6) |
| 2008 |
Jan
(8) |
Feb
(8) |
Mar
(16) |
Apr
|
May
(45) |
Jun
|
Jul
|
Aug
|
Sep
(18) |
Oct
(91) |
Nov
(60) |
Dec
|
| 2009 |
Jan
|
Feb
|
Mar
|
Apr
(9) |
May
(57) |
Jun
(6) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <nor...@us...> - 2009-06-15 17:41:14
|
Revision: 982
http://wact.svn.sourceforge.net/wact/?rev=982&view=rev
Author: norbertmocsnik
Date: 2009-06-15 17:40:34 +0000 (Mon, 15 Jun 2009)
Log Message:
-----------
Fixed memcached connection timeout.
Added implicit delay to clear() to ensure data granularity.
Modified Paths:
--------------
trunk/Wact/Cache/Store/Memcache.inc.php
Modified: trunk/Wact/Cache/Store/Memcache.inc.php
===================================================================
--- trunk/Wact/Cache/Store/Memcache.inc.php 2009-06-15 16:48:00 UTC (rev 981)
+++ trunk/Wact/Cache/Store/Memcache.inc.php 2009-06-15 17:40:34 UTC (rev 982)
@@ -57,7 +57,7 @@
* @param $port int
* @param $timeout int
*/
- public function __construct($host = 'localhost', $port = 11211, $timeout = NULL) {
+ public function __construct($host = 'localhost', $port = 11211, $timeout = 1) {
$this->host = $host;
$this->port = $port;
$this->timeout = $timeout;
@@ -155,6 +155,9 @@
}
/**
+ * Warning: "The flush has a one second granularity"
+ * so this function implicitly delays execution for 1 second.
+ *
* @see Wact_Cache_Store.clear
*/
public function clear() {
@@ -162,7 +165,13 @@
$this->connect();
}
- return $this->memcache->flush();
+ if (!$this->memcache->flush()) {
+ return FALSE;
+ }
+
+ sleep(1);
+
+ return TRUE;
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <nor...@us...> - 2009-06-15 16:49:06
|
Revision: 981
http://wact.svn.sourceforge.net/wact/?rev=981&view=rev
Author: norbertmocsnik
Date: 2009-06-15 16:48:00 +0000 (Mon, 15 Jun 2009)
Log Message:
-----------
Added memcache connect toggle. Fixed test case to connect only once.
Modified Paths:
--------------
trunk/Wact/Cache/Store/Memcache.inc.php
trunk/Wact/Cache/Store/Memcache.test.php
Modified: trunk/Wact/Cache/Store/Memcache.inc.php
===================================================================
--- trunk/Wact/Cache/Store/Memcache.inc.php 2009-06-15 16:32:06 UTC (rev 980)
+++ trunk/Wact/Cache/Store/Memcache.inc.php 2009-06-15 16:48:00 UTC (rev 981)
@@ -73,6 +73,8 @@
if (!$this->memcache->connect($this->host, $this->port, $this->timeout)) {
throw new Wact_Cache_Exception('Could not connect to memcached.');
}
+
+ $this->connected = TRUE;
}
/**
Modified: trunk/Wact/Cache/Store/Memcache.test.php
===================================================================
--- trunk/Wact/Cache/Store/Memcache.test.php 2009-06-15 16:32:06 UTC (rev 980)
+++ trunk/Wact/Cache/Store/Memcache.test.php 2009-06-15 16:48:00 UTC (rev 981)
@@ -6,9 +6,12 @@
* @var Wact_Cache_Store_Memcache
*/
protected $cache;
+
+ function __construct() {
+ $this->cache = new Wact_Cache_Store_Memcache();
+ }
function setUp() {
- $this->cache = new Wact_Cache_Store_Memcache();
}
function tearDown() {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <nor...@us...> - 2009-06-15 16:34:49
|
Revision: 980
http://wact.svn.sourceforge.net/wact/?rev=980&view=rev
Author: norbertmocsnik
Date: 2009-06-15 16:32:06 +0000 (Mon, 15 Jun 2009)
Log Message:
-----------
Added localhost as the default host for memcache.
Modified Paths:
--------------
trunk/Wact/Cache/Store/Memcache.inc.php
trunk/Wact/Cache/Store/Memcache.test.php
Modified: trunk/Wact/Cache/Store/Memcache.inc.php
===================================================================
--- trunk/Wact/Cache/Store/Memcache.inc.php 2009-06-15 16:30:39 UTC (rev 979)
+++ trunk/Wact/Cache/Store/Memcache.inc.php 2009-06-15 16:32:06 UTC (rev 980)
@@ -57,7 +57,7 @@
* @param $port int
* @param $timeout int
*/
- public function __construct($host, $port = 11211, $timeout = NULL) {
+ public function __construct($host = 'localhost', $port = 11211, $timeout = NULL) {
$this->host = $host;
$this->port = $port;
$this->timeout = $timeout;
Modified: trunk/Wact/Cache/Store/Memcache.test.php
===================================================================
--- trunk/Wact/Cache/Store/Memcache.test.php 2009-06-15 16:30:39 UTC (rev 979)
+++ trunk/Wact/Cache/Store/Memcache.test.php 2009-06-15 16:32:06 UTC (rev 980)
@@ -8,7 +8,7 @@
protected $cache;
function setUp() {
- $this->cache = new Wact_Cache_Store_Memcache('localhost');
+ $this->cache = new Wact_Cache_Store_Memcache();
}
function tearDown() {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <nor...@us...> - 2009-06-15 16:31:41
|
Revision: 979
http://wact.svn.sourceforge.net/wact/?rev=979&view=rev
Author: norbertmocsnik
Date: 2009-06-15 16:30:39 +0000 (Mon, 15 Jun 2009)
Log Message:
-----------
Added memcached cache store.
Added Paths:
-----------
trunk/Wact/Cache/Store/Memcache.inc.php
trunk/Wact/Cache/Store/Memcache.test.php
Added: trunk/Wact/Cache/Store/Memcache.inc.php
===================================================================
--- trunk/Wact/Cache/Store/Memcache.inc.php (rev 0)
+++ trunk/Wact/Cache/Store/Memcache.inc.php 2009-06-15 16:30:39 UTC (rev 979)
@@ -0,0 +1,168 @@
+<?php
+/**
+* Web Application Component Toolkit
+*
+* @link http://www.phpwact.org/
+*
+* @author Wact Development Team
+* @link http://www.phpwact.org/team
+*
+* @copyright Copyright 2006, Jeff Moore
+* @license http://opensource.org/licenses/mit-license.php MIT
+*/
+
+/**
+*/
+class Wact_Cache_Store_Memcache implements Wact_Cache_Store {
+
+ /**
+ * @var string memcached host
+ */
+ protected $host;
+
+ /**
+ * @var int memcached port
+ */
+ protected $port;
+
+ /**
+ * @var int Connection timeout
+ */
+ protected $timeout;
+
+ /**
+ * @var Memcache Memcache object
+ */
+ protected $memcache;
+
+ /**
+ * @var bool Connection state
+ */
+ protected $connected = FALSE;
+
+ /**
+ * Is the extension that supports this cache store available?
+ */
+ function isAvailable() {
+ return extension_loaded('memcache');
+ }
+
+ /**
+ * Class constructor.
+ *
+ * Stores connection parameters but doesn't connect
+ * to the memcached system yet.
+ *
+ * @param $host string
+ * @param $port int
+ * @param $timeout int
+ */
+ public function __construct($host, $port = 11211, $timeout = NULL) {
+ $this->host = $host;
+ $this->port = $port;
+ $this->timeout = $timeout;
+ }
+
+ /**
+ * Called internally before the first use of the cache.
+ *
+ * Throws Wact_Cache_Exception on connection failure.
+ */
+ protected function connect() {
+ $this->memcache = new Memcache();
+ if (!$this->memcache->connect($this->host, $this->port, $this->timeout)) {
+ throw new Wact_Cache_Exception('Could not connect to memcached.');
+ }
+ }
+
+ /**
+ * @see Wact_Cache_Store.store
+ */
+ public function store($key, $data, $lifetime = NULL) {
+ if (!$this->connected) {
+ $this->connect();
+ }
+
+ settype($key, 'string');
+ return $this->memcache->set($key, (string) $data, 0, $lifetime);
+ }
+
+ /**
+ * @see Wact_Cache_Store.storeValue
+ */
+ public function storeValue($key, $data, $lifetime = NULL) {
+ return $this->store($key, serialize($data), $lifetime);
+ }
+
+ /**
+ * @see Wact_Cache_Store.fetch
+ */
+ public function fetch($key, $default = NULL) {
+ if (!$this->connected) {
+ $this->connect();
+ }
+
+ settype($key, 'string');
+ $result = $this->memcache->get($key);
+ if ($result === FALSE) {
+ return $default;
+ } else {
+ return $result;
+ }
+ }
+
+ /**
+ * @see Wact_Cache_Store.fetch
+ */
+ public function fetchValue($key, $default = NULL) {
+ $result = $this->fetch($key, FALSE);
+ if ($result === FALSE) {
+ return $default;
+ }
+ return unserialize($result);
+ }
+
+ /**
+ * @see Wact_Cache_Store.includeCode
+ */
+ public function includeCode($key) {
+ $code = $this->fetch($key, FALSE);
+ if ($code !== FALSE) {
+ // Strange concatination works better with source code parsing tools
+ $result = eval(' ?' . '>' . $code . '<' . '?php ');
+
+ if (is_null($result)) {
+ return TRUE;
+ } else {
+ return $result;
+ }
+ }
+ return FALSE;
+ }
+
+ /**
+ * @see Wact_Cache_Store.remove
+ */
+ public function remove($key) {
+ if (!$this->connected) {
+ $this->connect();
+ }
+
+ settype($key, 'string');
+ return $this->memcache->delete($key);
+ }
+
+ /**
+ * @see Wact_Cache_Store.clear
+ */
+ public function clear() {
+ if (!$this->connected) {
+ $this->connect();
+ }
+
+ return $this->memcache->flush();
+ }
+
+}
+
+?>
\ No newline at end of file
Added: trunk/Wact/Cache/Store/Memcache.test.php
===================================================================
--- trunk/Wact/Cache/Store/Memcache.test.php (rev 0)
+++ trunk/Wact/Cache/Store/Memcache.test.php 2009-06-15 16:30:39 UTC (rev 979)
@@ -0,0 +1,24 @@
+<?php
+
+class WactMemcacheCacheTestCase extends Wact_Cache_Store_Test {
+
+ /**
+ * @var Wact_Cache_Store_Memcache
+ */
+ protected $cache;
+
+ function setUp() {
+ $this->cache = new Wact_Cache_Store_Memcache('localhost');
+ }
+
+ function tearDown() {
+ $this->cache->clear();
+ }
+
+ function skip() {
+ $this->skipUnless(extension_loaded('memcache'));
+ }
+
+}
+
+?>
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <nor...@us...> - 2009-06-14 10:45:04
|
Revision: 978
http://wact.svn.sourceforge.net/wact/?rev=978&view=rev
Author: norbertmocsnik
Date: 2009-06-14 10:45:00 +0000 (Sun, 14 Jun 2009)
Log Message:
-----------
Added extension_loaded() check to the XDebug coverage recorder test case.
Modified Paths:
--------------
trunk/Wact/Test/Coverage/Recorder.test.php
Modified: trunk/Wact/Test/Coverage/Recorder.test.php
===================================================================
--- trunk/Wact/Test/Coverage/Recorder.test.php 2009-06-11 15:51:22 UTC (rev 977)
+++ trunk/Wact/Test/Coverage/Recorder.test.php 2009-06-14 10:45:00 UTC (rev 978)
@@ -40,6 +40,10 @@
$this->assertTrue($recorder->isExcludedExtension('a.test.inc.php'));
}
+ function skip() {
+ $this->skipUnless(extension_loaded('xdebug'));
+ }
+
}
?>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <nor...@us...> - 2009-06-11 15:51:25
|
Revision: 977
http://wact.svn.sourceforge.net/wact/?rev=977&view=rev
Author: norbertmocsnik
Date: 2009-06-11 15:51:22 +0000 (Thu, 11 Jun 2009)
Log Message:
-----------
Fixed case to fully comply with autoloading.
Modified Paths:
--------------
trunk/Wact/Test/Coverage/Recorder.test.php
trunk/Wact/Test/ui/web.inc.php
trunk/runtests.php
Added Paths:
-----------
trunk/Wact/Test/Coverage/Recorder/Xdebug.inc.php
Removed Paths:
-------------
trunk/Wact/Test/Coverage/Recorder/XDebug.inc.php
Deleted: trunk/Wact/Test/Coverage/Recorder/XDebug.inc.php
===================================================================
--- trunk/Wact/Test/Coverage/Recorder/XDebug.inc.php 2009-05-25 22:59:00 UTC (rev 976)
+++ trunk/Wact/Test/Coverage/Recorder/XDebug.inc.php 2009-06-11 15:51:22 UTC (rev 977)
@@ -1,76 +0,0 @@
-<?php
-/**
-* Web Application Component Toolkit
-*
-* @link http://www.phpwact.org/
-*
-* @author Wact Development Team
-* @link http://www.phpwact.org/team
-*
-* @copyright Copyright 2006, Jeff Moore
-* @license http://opensource.org/licenses/mit-license.php MIT
-*/
-
-/**
- * Xdebug-based coverage recorder class
- */
-class Wact_Test_Coverage_Recorder_Xdebug extends Wact_Test_Coverage_Recorder {
- /**
- * @var string recorded coverage data for internal use
- */
- protected $coverageData;
-
- /**
- * Ensures that the requirements for this coverage recorder are currently available.
- */
- protected function checkRequirements() {
- if (!extension_loaded('xdebug')) {
- throw new Wact_Exception_Base('This coverage recorder requires the xdebug extension to run.');
- }
- }
-
- /**
- * Starts instrumentation.
- */
- public function startInstrumentation() {
- xdebug_start_code_coverage(XDEBUG_CC_UNUSED|XDEBUG_CC_DEAD_CODE);
- }
-
- /**
- * Stops instrumentation and stores collected information.
- */
- public function stopInstrumentation() {
- $this->coverageData = xdebug_get_code_coverage();
- xdebug_stop_code_coverage();
- }
-
- /**
- * Processes collected coverage data and returns generated report data.
- */
- public function processCoveredFiles() {
- $report = array();
-
- foreach ($this->coverageData as $filename => $lines) {
- if (!$this->isIncluded($filename)) {
- continue;
- }
-
- if ($this->isExcludedExtension($filename)) {
- continue;
- }
-
- $counts = array_count_values($lines);
-
- $report[$filename] = array(
- self::EXECUTABLE_LINES => array_sum($counts),
- self::COVERED_LINES => (isset($counts[1]) ? $counts[1] : 0),
- self::UNCOVERED_LINES => (isset($counts[-1]) ? $counts[-1] : 0),
- self::DEAD_LINES => (isset($counts[-2]) ? $counts[-2] : 0)
- );
- }
-
- return $report;
- }
-}
-
-?>
\ No newline at end of file
Copied: trunk/Wact/Test/Coverage/Recorder/Xdebug.inc.php (from rev 976, trunk/Wact/Test/Coverage/Recorder/XDebug.inc.php)
===================================================================
--- trunk/Wact/Test/Coverage/Recorder/Xdebug.inc.php (rev 0)
+++ trunk/Wact/Test/Coverage/Recorder/Xdebug.inc.php 2009-06-11 15:51:22 UTC (rev 977)
@@ -0,0 +1,76 @@
+<?php
+/**
+* Web Application Component Toolkit
+*
+* @link http://www.phpwact.org/
+*
+* @author Wact Development Team
+* @link http://www.phpwact.org/team
+*
+* @copyright Copyright 2006, Jeff Moore
+* @license http://opensource.org/licenses/mit-license.php MIT
+*/
+
+/**
+ * Xdebug-based coverage recorder class
+ */
+class Wact_Test_Coverage_Recorder_Xdebug extends Wact_Test_Coverage_Recorder {
+ /**
+ * @var string recorded coverage data for internal use
+ */
+ protected $coverageData;
+
+ /**
+ * Ensures that the requirements for this coverage recorder are currently available.
+ */
+ protected function checkRequirements() {
+ if (!extension_loaded('xdebug')) {
+ throw new Wact_Exception_Base('This coverage recorder requires the xdebug extension to run.');
+ }
+ }
+
+ /**
+ * Starts instrumentation.
+ */
+ public function startInstrumentation() {
+ xdebug_start_code_coverage(XDEBUG_CC_UNUSED|XDEBUG_CC_DEAD_CODE);
+ }
+
+ /**
+ * Stops instrumentation and stores collected information.
+ */
+ public function stopInstrumentation() {
+ $this->coverageData = xdebug_get_code_coverage();
+ xdebug_stop_code_coverage();
+ }
+
+ /**
+ * Processes collected coverage data and returns generated report data.
+ */
+ public function processCoveredFiles() {
+ $report = array();
+
+ foreach ($this->coverageData as $filename => $lines) {
+ if (!$this->isIncluded($filename)) {
+ continue;
+ }
+
+ if ($this->isExcludedExtension($filename)) {
+ continue;
+ }
+
+ $counts = array_count_values($lines);
+
+ $report[$filename] = array(
+ self::EXECUTABLE_LINES => array_sum($counts),
+ self::COVERED_LINES => (isset($counts[1]) ? $counts[1] : 0),
+ self::UNCOVERED_LINES => (isset($counts[-1]) ? $counts[-1] : 0),
+ self::DEAD_LINES => (isset($counts[-2]) ? $counts[-2] : 0)
+ );
+ }
+
+ return $report;
+ }
+}
+
+?>
\ No newline at end of file
Modified: trunk/Wact/Test/Coverage/Recorder.test.php
===================================================================
--- trunk/Wact/Test/Coverage/Recorder.test.php 2009-05-25 22:59:00 UTC (rev 976)
+++ trunk/Wact/Test/Coverage/Recorder.test.php 2009-06-11 15:51:22 UTC (rev 977)
@@ -3,13 +3,13 @@
class Wact_Test_Coverage_Recorder_TestCase extends Wact_Test_Case {
function testisIncludedEmpty() {
- $recorder = new Wact_Test_Coverage_Recorder_XDebug(array(), array(), null);
+ $recorder = new Wact_Test_Coverage_Recorder_Xdebug(array(), array(), null);
$this->assertFalse($recorder->isIncluded('/var/www/any'));
}
function testIsIncluded() {
$includePaths = array('/var/www/test', '/var/www/test2');
- $recorder = new Wact_Test_Coverage_Recorder_XDebug($includePaths, array(), null);
+ $recorder = new Wact_Test_Coverage_Recorder_Xdebug($includePaths, array(), null);
$this->assertTrue($recorder->isIncluded('/var/www/test'));
$this->assertTrue($recorder->isIncluded('/var/www/test/'));
@@ -30,7 +30,7 @@
}
function testIsExcludedExtension() {
- $recorder = new Wact_Test_Coverage_Recorder_XDebug(array(), array(), null);
+ $recorder = new Wact_Test_Coverage_Recorder_Xdebug(array(), array(), null);
$excludeExtensions = array('.test.php', '.test.inc.php');
$recorder->setExcludeExtensions($excludeExtensions);
Modified: trunk/Wact/Test/ui/web.inc.php
===================================================================
--- trunk/Wact/Test/ui/web.inc.php 2009-05-25 22:59:00 UTC (rev 976)
+++ trunk/Wact/Test/ui/web.inc.php 2009-06-11 15:51:22 UTC (rev 977)
@@ -332,9 +332,9 @@
$this->selected = dirname($_GET['testfile']);
$this->doRunTestFileCommand($_GET['testfile']);
} elseif (isset($_GET['coverfile']) /*&& $this->coverageStatus*/ ) {
- $this->doRunCoverageFileCommand($_GET['coverfile'], (isset($_GET['coverreporter']) ? $_GET['coverreporter'] : 'html'));
+ $this->doRunCoverageFileCommand($_GET['coverfile'], (isset($_GET['coverreporter']) ? $_GET['coverreporter'] : 'Html'));
} elseif (isset($_GET['coverdir']) /*&& $this->coverageStatus*/ ) {
- $this->doRunCoverageDirCommand($_GET['coverdir'], (isset($_GET['coverreporter']) ? $_GET['coverreporter'] : 'html'));
+ $this->doRunCoverageDirCommand($_GET['coverdir'], (isset($_GET['coverreporter']) ? $_GET['coverreporter'] : 'Html'));
} else {
$this->chooseTestPage();
}
Modified: trunk/runtests.php
===================================================================
--- trunk/runtests.php 2009-05-25 22:59:00 UTC (rev 976)
+++ trunk/runtests.php 2009-06-11 15:51:22 UTC (rev 977)
@@ -30,7 +30,7 @@
require_once 'simpletest/unit_tester.php';
// Load WACT
-if (is_resource($fh = @fopen('Wact/test/ui/web.inc.php', 'r', true))) {
+if (is_resource($fh = @fopen('Wact/Test/ui/web.inc.php', 'r', true))) {
fclose($fh);
} else {
?>
@@ -48,8 +48,8 @@
exit;
}
-require_once 'Wact/test/ui/web.inc.php';
-require_once 'Wact/Test/Config.inc.php';
+require_once 'Wact/Test/ui/web.inc.php';
+require_once 'Wact/Test/config.inc.php';
$project = Wact_Tool_Project::Load(dirname(__FILE__));
$project->test_runner = new WactTestRunnerConfig();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <nor...@us...> - 2009-05-25 22:59:03
|
Revision: 976
http://wact.svn.sourceforge.net/wact/?rev=976&view=rev
Author: norbertmocsnik
Date: 2009-05-25 22:59:00 +0000 (Mon, 25 May 2009)
Log Message:
-----------
Fixed classname cases.
Modified Paths:
--------------
trunk/Wact/Template/Compiler.inc.php
trunk/Wact/Template/tag/wact/include.tag.php
trunk/Wact/Test/Coverage/Recorder.test.php
Modified: trunk/Wact/Template/Compiler.inc.php
===================================================================
--- trunk/Wact/Template/Compiler.inc.php 2009-05-24 03:25:55 UTC (rev 975)
+++ trunk/Wact/Template/Compiler.inc.php 2009-05-25 22:59:00 UTC (rev 976)
@@ -145,7 +145,7 @@
public function readSource($resourceId) {
$source = $this->reader->readSource($resourceId);
if (is_null($source)) {
- throw new Wact_Template_Exception_Notfound($resourceId);
+ throw new Wact_Template_Exception_NotFound($resourceId);
} else {
return $source;
}
Modified: trunk/Wact/Template/tag/wact/include.tag.php
===================================================================
--- trunk/Wact/Template/tag/wact/include.tag.php 2009-05-24 03:25:55 UTC (rev 975)
+++ trunk/Wact/Template/tag/wact/include.tag.php 2009-05-25 22:59:00 UTC (rev 976)
@@ -26,7 +26,7 @@
public function preParse($treeBuilder) {
$file = $this->getAttributeValue('file');
if (empty($file)) {
- throw new Wact_Template_Compiler_Exception_Missingattribute(
+ throw new Wact_Template_Compiler_Exception_MissingAttribute(
'file', $this->getTag(), $this->sourceLocation->file, $this->sourceLocation->line);
}
Modified: trunk/Wact/Test/Coverage/Recorder.test.php
===================================================================
--- trunk/Wact/Test/Coverage/Recorder.test.php 2009-05-24 03:25:55 UTC (rev 975)
+++ trunk/Wact/Test/Coverage/Recorder.test.php 2009-05-25 22:59:00 UTC (rev 976)
@@ -3,13 +3,13 @@
class Wact_Test_Coverage_Recorder_TestCase extends Wact_Test_Case {
function testisIncludedEmpty() {
- $recorder = new Wact_Test_Coverage_Recorder_Xdebug(array(), array(), null);
+ $recorder = new Wact_Test_Coverage_Recorder_XDebug(array(), array(), null);
$this->assertFalse($recorder->isIncluded('/var/www/any'));
}
function testIsIncluded() {
$includePaths = array('/var/www/test', '/var/www/test2');
- $recorder = new Wact_Test_Coverage_Recorder_Xdebug($includePaths, array(), null);
+ $recorder = new Wact_Test_Coverage_Recorder_XDebug($includePaths, array(), null);
$this->assertTrue($recorder->isIncluded('/var/www/test'));
$this->assertTrue($recorder->isIncluded('/var/www/test/'));
@@ -30,7 +30,7 @@
}
function testIsExcludedExtension() {
- $recorder = new Wact_Test_Coverage_Recorder_Xdebug(array(), array(), null);
+ $recorder = new Wact_Test_Coverage_Recorder_XDebug(array(), array(), null);
$excludeExtensions = array('.test.php', '.test.inc.php');
$recorder->setExcludeExtensions($excludeExtensions);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <Jef...@us...> - 2009-05-24 03:25:58
|
Revision: 975
http://wact.svn.sourceforge.net/wact/?rev=975&view=rev
Author: JeffMoore
Date: 2009-05-24 03:25:55 +0000 (Sun, 24 May 2009)
Log Message:
-----------
fix path names to respect the new capitalization of file names
Modified Paths:
--------------
trunk/Wact/Template/Compiler.inc.php
trunk/Wact/Tool/Cli/dispatcher.php
trunk/Wact/Tool/Web/Console.inc.php
trunk/Wact/Tool/Web/tab/home.tab.php
trunk/Wact/Tool/Web/tab/test.tab.php
trunk/acceptance/compiler/codewriter.php
trunk/acceptance/exception/debug-collect-php-xcpt.php
trunk/acceptance/exception/debug-collect-wact-xcpt.php
trunk/acceptance/exception/debug-error.php
trunk/acceptance/exception/debug-php-xcpt.php
trunk/acceptance/exception/debug-wact-xcpt.php
trunk/acceptance/exception/debug-wrapped-php-xcpt.php
trunk/acceptance/exception/debug-wrapped-wact-xcpt.php
trunk/acceptance/exception/default-collect-php-xcpt.php
trunk/acceptance/exception/default-collect-wact-xcpt.php
trunk/acceptance/exception/default-php-xcpt.php
trunk/acceptance/exception/default-wact-xcpt.php
trunk/acceptance/exception/default-wrapped-php-xcpt.php
trunk/acceptance/exception/default-wrapped-wact-xcpt.php
trunk/acceptance/hangman/index.php
trunk/acceptance/template/composable/index.php
trunk/acceptance/template/forms/index.php
trunk/acceptance/template/hello/helloworld.php
trunk/acceptance/template/tags/core/block.php
trunk/acceptance/template/tags/core/comment.php
trunk/acceptance/template/tags/core/if.php
trunk/acceptance/template/tags/core/include.php
trunk/acceptance/template/tags/core/literal.php
trunk/acceptance/template/tags/core/placeholder.php
trunk/acceptance/template/tags/core/scope.php
trunk/acceptance/template/tags/core/wrap.php
trunk/acceptance/template/tags/core/wrap_more.php
trunk/acceptance/template/tags/core/wrap_simplest.php
trunk/acceptance/template/tags/front/link.php
trunk/acceptance/template/tags/repeat/delimited.php
trunk/acceptance/template/tags/repeat/repeat.php
trunk/acceptance/view/form/textarea.php
trunk/acceptance/view/repeat.php
trunk/acceptance/view/scope.php
trunk/bin/wact
trunk/examples/caseconverter/index.php
trunk/examples/contact/index.php
trunk/examples/hangman/index.php
trunk/index.php
trunk/runexamples.php
trunk/runtests.php
Modified: trunk/Wact/Template/Compiler.inc.php
===================================================================
--- trunk/Wact/Template/Compiler.inc.php 2009-05-23 19:34:02 UTC (rev 974)
+++ trunk/Wact/Template/Compiler.inc.php 2009-05-24 03:25:55 UTC (rev 975)
@@ -44,9 +44,9 @@
$this->loader = $loader;
$this->reader = $reader;
$this->tagLoader = new Wact_Plugin_Loader('.tag.php');
- $this->tagLoader->addPath('wact/template/tag', 'Wact_Template_Tag');
+ $this->tagLoader->addPath('Wact/Template/tag', 'Wact_Template_Tag');
$this->formatterLoader = new Wact_Plugin_Loader('.formatter.php');
- $this->formatterLoader->addPath('wact/template/formatter', 'Wact_Template_Formatter');
+ $this->formatterLoader->addPath('Wact/Template/formatter', 'Wact_Template_Formatter');
}
/**
Modified: trunk/Wact/Tool/Cli/dispatcher.php
===================================================================
--- trunk/Wact/Tool/Cli/dispatcher.php 2009-05-23 19:34:02 UTC (rev 974)
+++ trunk/Wact/Tool/Cli/dispatcher.php 2009-05-24 03:25:55 UTC (rev 975)
@@ -27,7 +27,7 @@
parent::__construct();
$this->commandLoader = new Wact_Plugin_Loader('.cmd.php');
- $this->commandLoader->addPath('wact/tool/cli/command', 'Wact_Cli_Command');
+ $this->commandLoader->addPath('Wact/Tool/Cli/command', 'Wact_Cli_Command');
$this->options->addOption(new Wact_Tool_Cli_Option(
'project',
Modified: trunk/Wact/Tool/Web/Console.inc.php
===================================================================
--- trunk/Wact/Tool/Web/Console.inc.php 2009-05-23 19:34:02 UTC (rev 974)
+++ trunk/Wact/Tool/Web/Console.inc.php 2009-05-24 03:25:55 UTC (rev 975)
@@ -32,7 +32,7 @@
function setup() {
$this->tabLoader = new Wact_Plugin_Loader('.tab.php');
- $this->tabLoader->addPath('wact/tool/web/tab', 'Wact_WebConsole_Tab');
+ $this->tabLoader->addPath('Wact/Tool/Web/tab', 'Wact_WebConsole_Tab');
foreach($this->getTabs() as $tab) {
$class = $this->tabLoader->load($tab);
@@ -46,7 +46,7 @@
->defaultTo('home')
->bindToModel('SelectedTab');
- $this->setView('wact/tool/web/layout.tpl.html');
+ $this->setView('Wact/Tool/Web/layout.tpl.html');
// This seems like the wrong place to do this
$this->onFocusDo($this, 'setTabsInModel');
Modified: trunk/Wact/Tool/Web/tab/home.tab.php
===================================================================
--- trunk/Wact/Tool/Web/tab/home.tab.php 2009-05-23 19:34:02 UTC (rev 974)
+++ trunk/Wact/Tool/Web/tab/home.tab.php 2009-05-24 03:25:55 UTC (rev 975)
@@ -22,7 +22,7 @@
}
function setup() {
- $this->setPartialView('tab', 'wact/tool/web/tab/home/_content.tpl.html');
+ $this->setPartialView('tab', 'Wact/Tool/Web/tab/home/_content.tpl.html');
}
}
Modified: trunk/Wact/Tool/Web/tab/test.tab.php
===================================================================
--- trunk/Wact/Tool/Web/tab/test.tab.php 2009-05-23 19:34:02 UTC (rev 974)
+++ trunk/Wact/Tool/Web/tab/test.tab.php 2009-05-24 03:25:55 UTC (rev 975)
@@ -22,7 +22,7 @@
}
function setup() {
- $this->setPartialView('tab', 'wact/tool/web/tab/test/_content.tpl.html');
+ $this->setPartialView('tab', 'Wact/Tool/Web/tab/test/_content.tpl.html');
}
}
Modified: trunk/acceptance/compiler/codewriter.php
===================================================================
--- trunk/acceptance/compiler/codewriter.php 2009-05-23 19:34:02 UTC (rev 974)
+++ trunk/acceptance/compiler/codewriter.php 2009-05-24 03:25:55 UTC (rev 975)
@@ -1,6 +1,6 @@
<?php
-require_once '../../wact/loader.inc.php';
+require_once '../../Wact/Loader.inc.php';
Wact_Loader::setupWact();
class ExampleCompiler {
Modified: trunk/acceptance/exception/debug-collect-php-xcpt.php
===================================================================
--- trunk/acceptance/exception/debug-collect-php-xcpt.php 2009-05-23 19:34:02 UTC (rev 974)
+++ trunk/acceptance/exception/debug-collect-php-xcpt.php 2009-05-24 03:25:55 UTC (rev 975)
@@ -1,6 +1,6 @@
<?php
-require_once '../../wact/loader.inc.php';
+require_once '../../Wact/Loader.inc.php';
Wact_Loader::setupWact();
$handler = new Wact_Exception_Handler();
Modified: trunk/acceptance/exception/debug-collect-wact-xcpt.php
===================================================================
--- trunk/acceptance/exception/debug-collect-wact-xcpt.php 2009-05-23 19:34:02 UTC (rev 974)
+++ trunk/acceptance/exception/debug-collect-wact-xcpt.php 2009-05-24 03:25:55 UTC (rev 975)
@@ -1,6 +1,6 @@
<?php
-require_once '../../wact/loader.inc.php';
+require_once '../../Wact/Loader.inc.php';
Wact_Loader::setupWact();
$handler = new Wact_Exception_Handler();
Modified: trunk/acceptance/exception/debug-error.php
===================================================================
--- trunk/acceptance/exception/debug-error.php 2009-05-23 19:34:02 UTC (rev 974)
+++ trunk/acceptance/exception/debug-error.php 2009-05-24 03:25:55 UTC (rev 975)
@@ -1,6 +1,6 @@
<?php
-require_once '../../wact/loader.inc.php';
+require_once '../../Wact/Loader.inc.php';
Wact_Loader::setupWact();
$errorHandler = new Wact_Error_Handler();
Modified: trunk/acceptance/exception/debug-php-xcpt.php
===================================================================
--- trunk/acceptance/exception/debug-php-xcpt.php 2009-05-23 19:34:02 UTC (rev 974)
+++ trunk/acceptance/exception/debug-php-xcpt.php 2009-05-24 03:25:55 UTC (rev 975)
@@ -1,6 +1,6 @@
<?php
-require_once '../../wact/loader.inc.php';
+require_once '../../Wact/Loader.inc.php';
Wact_Loader::setupWact();
$handler = new Wact_Exception_Handler();
Modified: trunk/acceptance/exception/debug-wact-xcpt.php
===================================================================
--- trunk/acceptance/exception/debug-wact-xcpt.php 2009-05-23 19:34:02 UTC (rev 974)
+++ trunk/acceptance/exception/debug-wact-xcpt.php 2009-05-24 03:25:55 UTC (rev 975)
@@ -1,6 +1,6 @@
<?php
-require_once '../../wact/loader.inc.php';
+require_once '../../Wact/Loader.inc.php';
Wact_Loader::setupWact();
$handler = new Wact_Exception_Handler();
Modified: trunk/acceptance/exception/debug-wrapped-php-xcpt.php
===================================================================
--- trunk/acceptance/exception/debug-wrapped-php-xcpt.php 2009-05-23 19:34:02 UTC (rev 974)
+++ trunk/acceptance/exception/debug-wrapped-php-xcpt.php 2009-05-24 03:25:55 UTC (rev 975)
@@ -1,6 +1,6 @@
<?php
-require_once '../../wact/loader.inc.php';
+require_once '../../Wact/Loader.inc.php';
Wact_Loader::setupWact();
$handler = new Wact_Exception_Handler();
Modified: trunk/acceptance/exception/debug-wrapped-wact-xcpt.php
===================================================================
--- trunk/acceptance/exception/debug-wrapped-wact-xcpt.php 2009-05-23 19:34:02 UTC (rev 974)
+++ trunk/acceptance/exception/debug-wrapped-wact-xcpt.php 2009-05-24 03:25:55 UTC (rev 975)
@@ -1,6 +1,6 @@
<?php
-require_once '../../wact/loader.inc.php';
+require_once '../../Wact/Loader.inc.php';
Wact_Loader::setupWact();
$handler = new Wact_Exception_Handler();
Modified: trunk/acceptance/exception/default-collect-php-xcpt.php
===================================================================
--- trunk/acceptance/exception/default-collect-php-xcpt.php 2009-05-23 19:34:02 UTC (rev 974)
+++ trunk/acceptance/exception/default-collect-php-xcpt.php 2009-05-24 03:25:55 UTC (rev 975)
@@ -1,6 +1,6 @@
<?php
-require_once '../../wact/loader.inc.php';
+require_once '../../Wact/Loader.inc.php';
Wact_Loader::setupWact();
function Oops() {
Modified: trunk/acceptance/exception/default-collect-wact-xcpt.php
===================================================================
--- trunk/acceptance/exception/default-collect-wact-xcpt.php 2009-05-23 19:34:02 UTC (rev 974)
+++ trunk/acceptance/exception/default-collect-wact-xcpt.php 2009-05-24 03:25:55 UTC (rev 975)
@@ -1,6 +1,6 @@
<?php
-require_once '../../wact/loader.inc.php';
+require_once '../../Wact/Loader.inc.php';
Wact_Loader::setupWact();
function Oops() {
Modified: trunk/acceptance/exception/default-php-xcpt.php
===================================================================
--- trunk/acceptance/exception/default-php-xcpt.php 2009-05-23 19:34:02 UTC (rev 974)
+++ trunk/acceptance/exception/default-php-xcpt.php 2009-05-24 03:25:55 UTC (rev 975)
@@ -1,6 +1,6 @@
<?php
-require_once '../../wact/loader.inc.php';
+require_once '../../Wact/Loader.inc.php';
Wact_Loader::setupWact();
function Oops() {
Modified: trunk/acceptance/exception/default-wact-xcpt.php
===================================================================
--- trunk/acceptance/exception/default-wact-xcpt.php 2009-05-23 19:34:02 UTC (rev 974)
+++ trunk/acceptance/exception/default-wact-xcpt.php 2009-05-24 03:25:55 UTC (rev 975)
@@ -1,6 +1,6 @@
<?php
-require_once '../../wact/loader.inc.php';
+require_once '../../Wact/Loader.inc.php';
Wact_Loader::setupWact();
function Oops() {
Modified: trunk/acceptance/exception/default-wrapped-php-xcpt.php
===================================================================
--- trunk/acceptance/exception/default-wrapped-php-xcpt.php 2009-05-23 19:34:02 UTC (rev 974)
+++ trunk/acceptance/exception/default-wrapped-php-xcpt.php 2009-05-24 03:25:55 UTC (rev 975)
@@ -1,6 +1,6 @@
<?php
-require_once '../../wact/loader.inc.php';
+require_once '../../Wact/Loader.inc.php';
Wact_Loader::setupWact();
function Oops() {
Modified: trunk/acceptance/exception/default-wrapped-wact-xcpt.php
===================================================================
--- trunk/acceptance/exception/default-wrapped-wact-xcpt.php 2009-05-23 19:34:02 UTC (rev 974)
+++ trunk/acceptance/exception/default-wrapped-wact-xcpt.php 2009-05-24 03:25:55 UTC (rev 975)
@@ -1,6 +1,6 @@
<?php
-require_once '../../wact/loader.inc.php';
+require_once '../../Wact/Loader.inc.php';
Wact_Loader::setupWact();
function Oops() {
Modified: trunk/acceptance/hangman/index.php
===================================================================
--- trunk/acceptance/hangman/index.php 2009-05-23 19:34:02 UTC (rev 974)
+++ trunk/acceptance/hangman/index.php 2009-05-24 03:25:55 UTC (rev 975)
@@ -5,7 +5,7 @@
Description: A simple hangman game designed to demonstrate WACT controllers and propagating state via HTTP without using sessions.<br \><small>(Ported from PRADO and refactored to eliminate viewstate and follow the MVC pattern.)</small>
*/
-require_once '../../wact/loader.inc.php';
+require_once '../../Wact/Loader.inc.php';
Wact_Loader::setupWact();
require_once 'model.inc.php';
Modified: trunk/acceptance/template/composable/index.php
===================================================================
--- trunk/acceptance/template/composable/index.php 2009-05-23 19:34:02 UTC (rev 974)
+++ trunk/acceptance/template/composable/index.php 2009-05-24 03:25:55 UTC (rev 975)
@@ -1,6 +1,6 @@
<?php
-require_once '../../../wact/loader.inc.php';
+require_once '../../../Wact/Loader.inc.php';
Wact_Loader::setupWact();
$reader = new Wact_Template_Reader_File(realpath('.'), 'templates');
Modified: trunk/acceptance/template/forms/index.php
===================================================================
--- trunk/acceptance/template/forms/index.php 2009-05-23 19:34:02 UTC (rev 974)
+++ trunk/acceptance/template/forms/index.php 2009-05-24 03:25:55 UTC (rev 975)
@@ -1,6 +1,6 @@
<?php
-require_once '../../../wact/loader.inc.php';
+require_once '../../../Wact/Loader.inc.php';
Wact_Loader::setupWact();
/**
Modified: trunk/acceptance/template/hello/helloworld.php
===================================================================
--- trunk/acceptance/template/hello/helloworld.php 2009-05-23 19:34:02 UTC (rev 974)
+++ trunk/acceptance/template/hello/helloworld.php 2009-05-24 03:25:55 UTC (rev 975)
@@ -1,6 +1,6 @@
<?php
-require_once '../../../wact/loader.inc.php';
+require_once '../../../Wact/Loader.inc.php';
Wact_Loader::setupWact();
$reader = new Wact_Template_Reader_File(realpath('.'), 'templates');
Modified: trunk/acceptance/template/tags/core/block.php
===================================================================
--- trunk/acceptance/template/tags/core/block.php 2009-05-23 19:34:02 UTC (rev 974)
+++ trunk/acceptance/template/tags/core/block.php 2009-05-24 03:25:55 UTC (rev 975)
@@ -1,6 +1,6 @@
<?php
-require_once '../../../../wact/loader.inc.php';
+require_once '../../../../Wact/Loader.inc.php';
Wact_Loader::setupWact();
$reader = new Wact_Template_Reader_File(realpath('.'), 'templates');
Modified: trunk/acceptance/template/tags/core/comment.php
===================================================================
--- trunk/acceptance/template/tags/core/comment.php 2009-05-23 19:34:02 UTC (rev 974)
+++ trunk/acceptance/template/tags/core/comment.php 2009-05-24 03:25:55 UTC (rev 975)
@@ -1,6 +1,6 @@
<?php
-require_once '../../../../wact/loader.inc.php';
+require_once '../../../../Wact/Loader.inc.php';
Wact_Loader::setupWact();
$reader = new Wact_Template_Reader_File(realpath('.'), 'templates');
Modified: trunk/acceptance/template/tags/core/if.php
===================================================================
--- trunk/acceptance/template/tags/core/if.php 2009-05-23 19:34:02 UTC (rev 974)
+++ trunk/acceptance/template/tags/core/if.php 2009-05-24 03:25:55 UTC (rev 975)
@@ -1,6 +1,6 @@
<?php
-require_once '../../../../wact/loader.inc.php';
+require_once '../../../../Wact/Loader.inc.php';
Wact_Loader::setupWact();
$reader = new Wact_Template_Reader_File(realpath('.'), 'templates');
Modified: trunk/acceptance/template/tags/core/include.php
===================================================================
--- trunk/acceptance/template/tags/core/include.php 2009-05-23 19:34:02 UTC (rev 974)
+++ trunk/acceptance/template/tags/core/include.php 2009-05-24 03:25:55 UTC (rev 975)
@@ -1,6 +1,6 @@
<?php
-require_once '../../../../wact/loader.inc.php';
+require_once '../../../../Wact/Loader.inc.php';
Wact_Loader::setupWact();
$reader = new Wact_Template_Reader_File(realpath('.'), 'templates');
Modified: trunk/acceptance/template/tags/core/literal.php
===================================================================
--- trunk/acceptance/template/tags/core/literal.php 2009-05-23 19:34:02 UTC (rev 974)
+++ trunk/acceptance/template/tags/core/literal.php 2009-05-24 03:25:55 UTC (rev 975)
@@ -1,6 +1,6 @@
<?php
-require_once '../../../../wact/loader.inc.php';
+require_once '../../../../Wact/Loader.inc.php';
Wact_Loader::setupWact();
$reader = new Wact_Template_Reader_File(realpath('.'), 'templates');
Modified: trunk/acceptance/template/tags/core/placeholder.php
===================================================================
--- trunk/acceptance/template/tags/core/placeholder.php 2009-05-23 19:34:02 UTC (rev 974)
+++ trunk/acceptance/template/tags/core/placeholder.php 2009-05-24 03:25:55 UTC (rev 975)
@@ -1,6 +1,6 @@
<?php
-require_once '../../../../wact/loader.inc.php';
+require_once '../../../../Wact/Loader.inc.php';
Wact_Loader::setupWact();
$reader = new Wact_Template_Reader_File(realpath('.'), 'templates');
Modified: trunk/acceptance/template/tags/core/scope.php
===================================================================
--- trunk/acceptance/template/tags/core/scope.php 2009-05-23 19:34:02 UTC (rev 974)
+++ trunk/acceptance/template/tags/core/scope.php 2009-05-24 03:25:55 UTC (rev 975)
@@ -1,6 +1,6 @@
<?php
-require_once '../../../../wact/loader.inc.php';
+require_once '../../../../Wact/Loader.inc.php';
Wact_Loader::setupWact();
$reader = new Wact_Template_Reader_File(realpath('.'), 'templates');
Modified: trunk/acceptance/template/tags/core/wrap.php
===================================================================
--- trunk/acceptance/template/tags/core/wrap.php 2009-05-23 19:34:02 UTC (rev 974)
+++ trunk/acceptance/template/tags/core/wrap.php 2009-05-24 03:25:55 UTC (rev 975)
@@ -1,6 +1,6 @@
<?php
-require_once '../../../../wact/loader.inc.php';
+require_once '../../../../Wact/Loader.inc.php';
Wact_Loader::setupWact();
$reader = new Wact_Template_Reader_File(realpath('.'), 'templates');
Modified: trunk/acceptance/template/tags/core/wrap_more.php
===================================================================
--- trunk/acceptance/template/tags/core/wrap_more.php 2009-05-23 19:34:02 UTC (rev 974)
+++ trunk/acceptance/template/tags/core/wrap_more.php 2009-05-24 03:25:55 UTC (rev 975)
@@ -1,6 +1,6 @@
<?php
-require_once '../../../../wact/loader.inc.php';
+require_once '../../../../Wact/Loader.inc.php';
Wact_Loader::setupWact();
$reader = new Wact_Template_Reader_File(realpath('.'), 'templates');
Modified: trunk/acceptance/template/tags/core/wrap_simplest.php
===================================================================
--- trunk/acceptance/template/tags/core/wrap_simplest.php 2009-05-23 19:34:02 UTC (rev 974)
+++ trunk/acceptance/template/tags/core/wrap_simplest.php 2009-05-24 03:25:55 UTC (rev 975)
@@ -1,6 +1,6 @@
<?php
-require_once '../../../../wact/loader.inc.php';
+require_once '../../../../Wact/Loader.inc.php';
Wact_Loader::setupWact();
$reader = new Wact_Template_Reader_File(realpath('.'), 'templates');
Modified: trunk/acceptance/template/tags/front/link.php
===================================================================
--- trunk/acceptance/template/tags/front/link.php 2009-05-23 19:34:02 UTC (rev 974)
+++ trunk/acceptance/template/tags/front/link.php 2009-05-24 03:25:55 UTC (rev 975)
@@ -1,6 +1,6 @@
<?php
-require_once '../../../../wact/loader.inc.php';
+require_once '../../../../Wact/Loader.inc.php';
Wact_Loader::setupWact();
class WactFrontLinkTagExample extends Wact_Controller_Base {
Modified: trunk/acceptance/template/tags/repeat/delimited.php
===================================================================
--- trunk/acceptance/template/tags/repeat/delimited.php 2009-05-23 19:34:02 UTC (rev 974)
+++ trunk/acceptance/template/tags/repeat/delimited.php 2009-05-24 03:25:55 UTC (rev 975)
@@ -1,6 +1,6 @@
<?php
-require_once '../../../../wact/loader.inc.php';
+require_once '../../../../Wact/Loader.inc.php';
Wact_Loader::setupWact();
$reader = new Wact_Template_Reader_File();
Modified: trunk/acceptance/template/tags/repeat/repeat.php
===================================================================
--- trunk/acceptance/template/tags/repeat/repeat.php 2009-05-23 19:34:02 UTC (rev 974)
+++ trunk/acceptance/template/tags/repeat/repeat.php 2009-05-24 03:25:55 UTC (rev 975)
@@ -1,6 +1,6 @@
<?php
-require_once '../../../../wact/loader.inc.php';
+require_once '../../../../Wact/Loader.inc.php';
Wact_Loader::setupWact();
$reader = new Wact_Template_Reader_File();
Modified: trunk/acceptance/view/form/textarea.php
===================================================================
--- trunk/acceptance/view/form/textarea.php 2009-05-23 19:34:02 UTC (rev 974)
+++ trunk/acceptance/view/form/textarea.php 2009-05-24 03:25:55 UTC (rev 975)
@@ -1,6 +1,6 @@
<?php
-require_once '../../../wact/loader.inc.php';
+require_once '../../../Wact/Loader.inc.php';
Wact_Loader::setupWact();
class MainView extends Wact_View_Root {
Modified: trunk/acceptance/view/repeat.php
===================================================================
--- trunk/acceptance/view/repeat.php 2009-05-23 19:34:02 UTC (rev 974)
+++ trunk/acceptance/view/repeat.php 2009-05-24 03:25:55 UTC (rev 975)
@@ -1,6 +1,6 @@
<?php
-require_once '../../wact/loader.inc.php';
+require_once '../../Wact/Loader.inc.php';
Wact_Loader::setupWact();
class MyItem extends Wact_View_Partial {
Modified: trunk/acceptance/view/scope.php
===================================================================
--- trunk/acceptance/view/scope.php 2009-05-23 19:34:02 UTC (rev 974)
+++ trunk/acceptance/view/scope.php 2009-05-24 03:25:55 UTC (rev 975)
@@ -1,6 +1,6 @@
<?php
-require_once '../../wact/loader.inc.php';
+require_once '../../Wact/Loader.inc.php';
Wact_Loader::setupWact();
class InnerView extends Wact_View_Scoped {
Modified: trunk/bin/wact
===================================================================
--- trunk/bin/wact 2009-05-23 19:34:02 UTC (rev 974)
+++ trunk/bin/wact 2009-05-24 03:25:55 UTC (rev 975)
@@ -55,14 +55,14 @@
// Let the include path sort out the proper command to execute.
- if (is_resource(\$fh = @fopen('wact/tool/cli/dispatcher.php', 'r', true))) {
+ if (is_resource(\$fh = @fopen('Wact/Tool/Cli/dispatcher.php', 'r', true))) {
fclose(\$fh);
unset(\$fh);
- require_once 'wact/loader.inc.php';
+ require_once 'Wact/Loader.inc.php';
Wact_Loader::setupWact();
- require_once 'wact/tool/cli/dispatcher.php';
+ require_once 'Wact/Tool/Cli/dispatcher.php';
\$dispatcher = new Wact_Tool_Cli_Dispatcher();
\$dispatcher->run(Console_Getopt::readPHPArgv());
Modified: trunk/examples/caseconverter/index.php
===================================================================
--- trunk/examples/caseconverter/index.php 2009-05-23 19:34:02 UTC (rev 974)
+++ trunk/examples/caseconverter/index.php 2009-05-24 03:25:55 UTC (rev 975)
@@ -5,7 +5,7 @@
Description: A simple form to demonstrate using controllers with templates
*/
-require_once '../../wact/loader.inc.php';
+require_once '../../Wact/Loader.inc.php';
Wact_Loader::setupWact();
class CaseConverter extends Wact_Controller_Base {
Modified: trunk/examples/contact/index.php
===================================================================
--- trunk/examples/contact/index.php 2009-05-23 19:34:02 UTC (rev 974)
+++ trunk/examples/contact/index.php 2009-05-24 03:25:55 UTC (rev 975)
@@ -5,7 +5,7 @@
Description: A simple form to collect and validate contact information.
*/
-require_once '../../wact/loader.inc.php';
+require_once '../../Wact/Loader.inc.php';
Wact_Loader::setupWact();
/*
Modified: trunk/examples/hangman/index.php
===================================================================
--- trunk/examples/hangman/index.php 2009-05-23 19:34:02 UTC (rev 974)
+++ trunk/examples/hangman/index.php 2009-05-24 03:25:55 UTC (rev 975)
@@ -5,7 +5,7 @@
Description: A simple hangman game designed to demonstrate WACT controllers and propagating state via HTTP without using sessions.<br \><small>(Ported from PRADO and refactored to eliminate viewstate and follow the MVC pattern.)</small>
*/
-require_once '../../wact/loader.inc.php';
+require_once '../../Wact/Loader.inc.php';
Wact_Loader::setupWact();
require_once 'model.inc.php';
Modified: trunk/index.php
===================================================================
--- trunk/index.php 2009-05-23 19:34:02 UTC (rev 974)
+++ trunk/index.php 2009-05-24 03:25:55 UTC (rev 975)
@@ -4,7 +4,7 @@
* Framework.
*/
-if (is_resource($fh = @fopen('wact/loader.inc.php', 'r', true))) {
+if (is_resource($fh = @fopen('Wact/Loader.inc.php', 'r', true))) {
fclose($fh);
} else {
?>
@@ -22,7 +22,7 @@
exit;
}
-require_once 'wact/loader.inc.php';
+require_once 'Wact/Loader.inc.php';
Wact_Loader::setupWact();
$config = new Wact_Config_Registry();
Modified: trunk/runexamples.php
===================================================================
--- trunk/runexamples.php 2009-05-23 19:34:02 UTC (rev 974)
+++ trunk/runexamples.php 2009-05-24 03:25:55 UTC (rev 975)
@@ -1,6 +1,6 @@
<?php
-require_once 'wact/loader.inc.php';
+require_once 'Wact/Loader.inc.php';
Wact_Loader::setupWact();
class WactExample {
Modified: trunk/runtests.php
===================================================================
--- trunk/runtests.php 2009-05-23 19:34:02 UTC (rev 974)
+++ trunk/runtests.php 2009-05-24 03:25:55 UTC (rev 975)
@@ -1,6 +1,6 @@
<?php
-require_once 'wact/loader.inc.php';
+require_once 'Wact/Loader.inc.php';
Wact_Loader::setupWact();
// Load SimpleTest
@@ -30,7 +30,7 @@
require_once 'simpletest/unit_tester.php';
// Load WACT
-if (is_resource($fh = @fopen('wact/test/ui/web.inc.php', 'r', true))) {
+if (is_resource($fh = @fopen('Wact/test/ui/web.inc.php', 'r', true))) {
fclose($fh);
} else {
?>
@@ -48,8 +48,8 @@
exit;
}
-require_once 'wact/test/ui/web.inc.php';
-require_once 'wact/test/config.inc.php';
+require_once 'Wact/test/ui/web.inc.php';
+require_once 'Wact/Test/Config.inc.php';
$project = Wact_Tool_Project::Load(dirname(__FILE__));
$project->test_runner = new WactTestRunnerConfig();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <Jef...@us...> - 2009-05-23 18:38:56
|
Revision: 973
http://wact.svn.sourceforge.net/wact/?rev=973&view=rev
Author: JeffMoore
Date: 2009-05-23 18:38:32 +0000 (Sat, 23 May 2009)
Log Message:
-----------
fix botched rename
Added Paths:
-----------
trunk/Wact/Request/Segmented.inc.php
Removed Paths:
-------------
trunk/Wact/Request/Segemented.inc.php
Deleted: trunk/Wact/Request/Segemented.inc.php
===================================================================
--- trunk/Wact/Request/Segemented.inc.php 2009-05-23 18:36:04 UTC (rev 972)
+++ trunk/Wact/Request/Segemented.inc.php 2009-05-23 18:38:32 UTC (rev 973)
@@ -1,193 +0,0 @@
-<?php
-/**
-* Web Application Component Toolkit
-*
-* @link http://www.phpwact.org/
-*
-* @author Wact Development Team
-* @link http://www.phpwact.org/team
-*
-* @copyright Copyright 2006, Jeff Moore
-* @license http://opensource.org/licenses/mit-license.php MIT
-*/
-
-/*
-* This parameter type represents a value derived from another parameter by
-* dividing that base parameter up into segments.
-* Segmented parameters are related by their baseName's and they write (collect) values
-* to the CHANNEL_DERIVED channel until the top-level segmented parameter is reached.
-* The top-level segmented parameter writes the joined segments
-* through its base parameter (e.g. a pathinfo parameter) to the transition.
-*/
-class Wact_Request_Segmented extends Wact_Request_Parameter {
-
- /**
- * The basis for our segmentation
- * @var Wact_Request_Parameter
- */
- protected $baseName;
-
- /**
- * The controller that this parameter is associated with
- * @var Wact_Controller_Base
- */
- protected $definingController;
-
- private $segmentationPattern = '/^\/(.*)(\/.*){0,1}$/U';
-
- /**
- * Construct this parameter
- */
- function __construct($name, $baseName = NULL) {
- $this->baseName = $baseName;
- parent::__construct($name);
- }
-
- /**
- */
- function getBaseName() {
- return $this->baseName;
- }
-
- /**
- */
- function bindToController($definingController) {
- $this->definingController = $definingController;
- }
-
- /**
- */
- function getBaseParameter() {
- $focus = $this->definingController;
- while ($focus) {
- $parameters = $focus->getParameters();
-
- // look for a related segmented parameter
- foreach(array_reverse(array_keys($parameters)) as $key) {
- $parameter = $parameters[$key];
- if ($parameter === $this) {
- continue;
- }
- if ($parameter instanceof Wact_Request_Segmented) {
- if ($parameter->getBaseName() == $this->baseName) {
- return $parameter;
- }
- }
- }
-
- // no related segmented parameters found
- // let's see if the top-level base parameter is here
- foreach(array_reverse(array_keys($parameters)) as $key) {
- $parameter = $parameters[$key];
- if ($parameter === $this) {
- continue;
- }
- if (!$parameter instanceof Wact_Request_Segmented) {
- if ($parameter->getName() == $this->baseName) {
- return $parameter;
- }
- }
- }
-
- $focus = $focus->parent;
- }
- throw new Wact_Request_Exception('Segment base not found');
- }
-
- /**
- */
- function getRestOfSegment() {
- $base = $this->getBaseParameter();
-
- if (method_exists($base, 'getRestOfSegment')) {
- $value = $base->getRestOfSegment();
- } else {
- $value = $base->getRawValue();
- }
-
- // take /foo/bar and return /bar
-
- if (preg_match($this->segmentationPattern, $value, $matches)) {
- return $matches[2];
- } else {
- die("what happens now?");
- }
-
- }
-
- /**
- */
- function getRawValue() {
- $base = $this->getBaseParameter();
-
- if (method_exists($base, 'getRestOfSegment')) {
- $baseValue = $base->getRestOfSegment();
- } else {
- $baseValue = $base->getRawValue();
- }
-
- //take /foo/bar and return foo
- if (preg_match($this->segmentationPattern, $baseValue, $matches)) {
- return $matches[1];
- } else {
- die("What happens now?");
- }
- }
-
- /**
- *
- */
- function hasValue() {
- $base = $this->getBaseParameter();
-
- if ($base->hasValue()) {
- if (method_exists($base, 'getRestOfSegment')) {
- $value = $base->getRestOfSegment();
- } else {
- $value = $base->getRawValue();
- }
-
- return (boolean) preg_match($this->segmentationPattern, $value);
- } else {
- return FALSE;
- }
-
- }
-
- protected function joinSegment($value, $segment) {
- if (empty($value) && empty($segment)) {
- return '';
- } else {
- if (empty($segment)) {
- return $value;
- } else {
- return $value . '/' . $segment;
- }
- }
- }
-
- /**
- */
- function WriteValueToTransition($transition, $value) {
-
- $segment = $transition->readValueFromChannel(
- Wact_Controller_Transition_Link::CHANNEL_DERIVED,
- $this->baseName);
-
- $value = $this->joinSegment($value, $segment);
-
- if (!empty($segment) || $this->getDefault() !== $value) {
- $base = $this->getBaseParameter();
- if ($base instanceof Wact_Request_Segmented) {
- $transition->writeValueToChannel(Wact_Controller_Transition_Link::CHANNEL_DERIVED,
- $this->baseName,
- $value);
- } else {
- $base->writeValueToTransition($transition, $value);
- }
- }
- }
-
-}
-
-?>
\ No newline at end of file
Copied: trunk/Wact/Request/Segmented.inc.php (from rev 972, trunk/Wact/Request/Segemented.inc.php)
===================================================================
--- trunk/Wact/Request/Segmented.inc.php (rev 0)
+++ trunk/Wact/Request/Segmented.inc.php 2009-05-23 18:38:32 UTC (rev 973)
@@ -0,0 +1,193 @@
+<?php
+/**
+* Web Application Component Toolkit
+*
+* @link http://www.phpwact.org/
+*
+* @author Wact Development Team
+* @link http://www.phpwact.org/team
+*
+* @copyright Copyright 2006, Jeff Moore
+* @license http://opensource.org/licenses/mit-license.php MIT
+*/
+
+/*
+* This parameter type represents a value derived from another parameter by
+* dividing that base parameter up into segments.
+* Segmented parameters are related by their baseName's and they write (collect) values
+* to the CHANNEL_DERIVED channel until the top-level segmented parameter is reached.
+* The top-level segmented parameter writes the joined segments
+* through its base parameter (e.g. a pathinfo parameter) to the transition.
+*/
+class Wact_Request_Segmented extends Wact_Request_Parameter {
+
+ /**
+ * The basis for our segmentation
+ * @var Wact_Request_Parameter
+ */
+ protected $baseName;
+
+ /**
+ * The controller that this parameter is associated with
+ * @var Wact_Controller_Base
+ */
+ protected $definingController;
+
+ private $segmentationPattern = '/^\/(.*)(\/.*){0,1}$/U';
+
+ /**
+ * Construct this parameter
+ */
+ function __construct($name, $baseName = NULL) {
+ $this->baseName = $baseName;
+ parent::__construct($name);
+ }
+
+ /**
+ */
+ function getBaseName() {
+ return $this->baseName;
+ }
+
+ /**
+ */
+ function bindToController($definingController) {
+ $this->definingController = $definingController;
+ }
+
+ /**
+ */
+ function getBaseParameter() {
+ $focus = $this->definingController;
+ while ($focus) {
+ $parameters = $focus->getParameters();
+
+ // look for a related segmented parameter
+ foreach(array_reverse(array_keys($parameters)) as $key) {
+ $parameter = $parameters[$key];
+ if ($parameter === $this) {
+ continue;
+ }
+ if ($parameter instanceof Wact_Request_Segmented) {
+ if ($parameter->getBaseName() == $this->baseName) {
+ return $parameter;
+ }
+ }
+ }
+
+ // no related segmented parameters found
+ // let's see if the top-level base parameter is here
+ foreach(array_reverse(array_keys($parameters)) as $key) {
+ $parameter = $parameters[$key];
+ if ($parameter === $this) {
+ continue;
+ }
+ if (!$parameter instanceof Wact_Request_Segmented) {
+ if ($parameter->getName() == $this->baseName) {
+ return $parameter;
+ }
+ }
+ }
+
+ $focus = $focus->parent;
+ }
+ throw new Wact_Request_Exception('Segment base not found');
+ }
+
+ /**
+ */
+ function getRestOfSegment() {
+ $base = $this->getBaseParameter();
+
+ if (method_exists($base, 'getRestOfSegment')) {
+ $value = $base->getRestOfSegment();
+ } else {
+ $value = $base->getRawValue();
+ }
+
+ // take /foo/bar and return /bar
+
+ if (preg_match($this->segmentationPattern, $value, $matches)) {
+ return $matches[2];
+ } else {
+ die("what happens now?");
+ }
+
+ }
+
+ /**
+ */
+ function getRawValue() {
+ $base = $this->getBaseParameter();
+
+ if (method_exists($base, 'getRestOfSegment')) {
+ $baseValue = $base->getRestOfSegment();
+ } else {
+ $baseValue = $base->getRawValue();
+ }
+
+ //take /foo/bar and return foo
+ if (preg_match($this->segmentationPattern, $baseValue, $matches)) {
+ return $matches[1];
+ } else {
+ die("What happens now?");
+ }
+ }
+
+ /**
+ *
+ */
+ function hasValue() {
+ $base = $this->getBaseParameter();
+
+ if ($base->hasValue()) {
+ if (method_exists($base, 'getRestOfSegment')) {
+ $value = $base->getRestOfSegment();
+ } else {
+ $value = $base->getRawValue();
+ }
+
+ return (boolean) preg_match($this->segmentationPattern, $value);
+ } else {
+ return FALSE;
+ }
+
+ }
+
+ protected function joinSegment($value, $segment) {
+ if (empty($value) && empty($segment)) {
+ return '';
+ } else {
+ if (empty($segment)) {
+ return $value;
+ } else {
+ return $value . '/' . $segment;
+ }
+ }
+ }
+
+ /**
+ */
+ function WriteValueToTransition($transition, $value) {
+
+ $segment = $transition->readValueFromChannel(
+ Wact_Controller_Transition_Link::CHANNEL_DERIVED,
+ $this->baseName);
+
+ $value = $this->joinSegment($value, $segment);
+
+ if (!empty($segment) || $this->getDefault() !== $value) {
+ $base = $this->getBaseParameter();
+ if ($base instanceof Wact_Request_Segmented) {
+ $transition->writeValueToChannel(Wact_Controller_Transition_Link::CHANNEL_DERIVED,
+ $this->baseName,
+ $value);
+ } else {
+ $base->writeValueToTransition($transition, $value);
+ }
+ }
+ }
+
+}
+
+?>
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <Jef...@us...> - 2009-05-23 18:36:09
|
Revision: 972
http://wact.svn.sourceforge.net/wact/?rev=972&view=rev
Author: JeffMoore
Date: 2009-05-23 18:36:04 +0000 (Sat, 23 May 2009)
Log Message:
-----------
We now expect the case of a class to match the case of its filename.
Modified Paths:
--------------
trunk/Wact/Loader.inc.php
Modified: trunk/Wact/Loader.inc.php
===================================================================
--- trunk/Wact/Loader.inc.php 2009-05-23 18:27:40 UTC (rev 971)
+++ trunk/Wact/Loader.inc.php 2009-05-23 18:36:04 UTC (rev 972)
@@ -40,22 +40,14 @@
* @var string
*/
protected $extension;
-
- /**
- * Temporary mechanism to convert filenames to lower case as we convert
- * to PEAR standards for file naming and autoloading.
- */
- protected $convertToLower;
/**
* @param $namespace Restrict loading to classes with this namespace name.
* @param $extension Extension for php class files.
- * @param $convertToLower A temporary compatibility mechanism
- */
- function __construct($namespace = self::ANY_NAMESPACE, $extension = self::WACT_CLASS_EXTENSION, $convertToLower = TRUE) {
+' */
+ function __construct($namespace = self::ANY_NAMESPACE, $extension = self::WACT_CLASS_EXTENSION) {
$this->namespace = $namespace;
$this->extension = $extension;
- $this->convertToLower = $convertToLower;
}
/**
@@ -70,10 +62,7 @@
return false;
}
- $filename = str_replace('_', DIRECTORY_SEPARATOR,
- ($this->convertToLower ? strtolower($class) : $class) .
- $this->extension);
- $filename = str_replace('::', DIRECTORY_SEPARATOR, $filename);
+ $filename = str_replace('_', DIRECTORY_SEPARATOR, $class . $this->extension);
if($fp = @fopen($filename, 'r', true)) {
fclose($fp);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <Jef...@us...> - 2009-05-23 18:27:48
|
Revision: 971
http://wact.svn.sourceforge.net/wact/?rev=971&view=rev
Author: JeffMoore
Date: 2009-05-23 18:27:40 +0000 (Sat, 23 May 2009)
Log Message:
-----------
fix botcched rename
Removed Paths:
-------------
trunk/Wact/Config/Registry/factory.test.php
Deleted: trunk/Wact/Config/Registry/factory.test.php
===================================================================
--- trunk/Wact/Config/Registry/factory.test.php 2009-05-23 18:27:32 UTC (rev 970)
+++ trunk/Wact/Config/Registry/factory.test.php 2009-05-23 18:27:40 UTC (rev 971)
@@ -1,257 +0,0 @@
-<?php
-
-class WactConfigRegistryFactoryTester {
- public $param;
- public $optional;
- public $value;
- /**
- * @var prop_type
- */
- public $prop;
-
- /**
- * @param param_type | string $param The password to use for something or other
- * @param optional_type|string $optional The password to use for something or other
- */
- function __construct($param, $optional = NULL) {
- $this->param = $param;
- $this->optional = $optional;
- }
-
- /**
- * @param value_type|string $value The password to use for something or other
- */
- function setValue($value) {
- $this->value = $value;
- }
-}
-
-Mock::generate('Wact_Config_Registry', 'MockWact_Config_Registry');
-
-class WactConfigFactoryTestCase extends Wact_Test_Case {
-
- /**
- * Enter description here...
- *
- * @var unknown_type
- */
- protected $registry;
-
- /**
- * Enter description here...
- *
- * @var unknown_type
- */
- protected $context;
-
- function setUp() {
- $this->factory = new Wact_Config_Registry_Factory();
- $this->context = new MockWact_Config_Registry($this);
- }
-
- function testCreatingValue() {
- $this->factory->asValue('unique');
- $value = $this->factory->createInstance(NULL);
-
- $this->assertEqual($value, 'unique');
- }
-
- function testCreatingStdClass() {
- $obj = $this->factory->createInstance(NULL);
-
- $this->assertIsa($obj, "StdClass");
- }
-
- function testCreatingAliasToType() {
- $this->context->setReturnValue('get', 'bar', array('foo', '*'));
-
- $this->factory->asAliasToType('foo');
- $obj = $this->factory->createInstance($this->context);
-
- $this->assertEqual($obj, 'bar');
- }
-
- function testCreatingTestClass() {
- $this->context->setReturnValue('get', 'bar', array('param_type'));
-
- $this->factory->asClass('WactConfigRegistryFactoryTester');
- $obj = $this->factory->createInstance($this->context);
-
- $this->assertIsa($obj, "WactConfigRegistryFactoryTester");
- $this->assertEqual($obj->param, 'bar');
- }
-
- function testCreatingClassWithSpecifiedParameter() {
- $this->context->expectNever('get');
-
- $this->factory->asClass('WactConfigRegistryFactoryTester');
- $obj = $this->factory->createInstance($this->context, array('foo'));
-
- $this->assertIsa($obj, "WactConfigRegistryFactoryTester");
- $this->assertEqual($obj->param, 'foo');
- }
-
- function testCreatingClassWithParameterValue() {
- $this->context->expectNever('get');
-
- $this->factory
- ->asClass('WactConfigRegistryFactoryTester')
- ->parameterValue('param', 'foo');
- $obj = $this->factory->createInstance($this->context);
-
- $this->assertIsa($obj, "WactConfigRegistryFactoryTester");
- $this->assertEqual($obj->param, 'foo');
- }
-
- function testCreatingClassWithParameterValueNumeric() {
- $this->context->expectNever('get');
-
- $this->factory
- ->asClass('WactConfigRegistryFactoryTester')
- ->parameterValue(0, 'foo');
- $obj = $this->factory->createInstance($this->context);
-
- $this->assertIsa($obj, "WactConfigRegistryFactoryTester");
- $this->assertEqual($obj->param, 'foo');
- }
-
- function testCreatingClassWithParameterType() {
- $this->context->setReturnValue('get', 'bar', array('foo'));
-
- $this->factory
- ->asClass('WactConfigRegistryFactoryTester')
- ->parameterType('param', 'foo');
- $obj = $this->factory->createInstance($this->context);
-
- $this->assertIsa($obj, "WactConfigRegistryFactoryTester");
- $this->assertEqual($obj->param, 'bar');
- }
-
- function testCreatingClassWithParameterTypeNumeric() {
- $this->context->setReturnValue('get', 'bar', array('foo'));
-
- $this->factory
- ->asClass('WactConfigRegistryFactoryTester')
- ->parameterType(0, 'foo');
- $obj = $this->factory->createInstance($this->context);
-
- $this->assertIsa($obj, "WactConfigRegistryFactoryTester");
- $this->assertEqual($obj->param, 'bar');
- }
-
- function testForcingOptionalToBeRequired() {
- $this->context->setReturnValue('get', 'bar', array('optional_type'));
-
- $this->factory
- ->asClass('WactConfigRegistryFactoryTester')
- ->parameterRequired('optional');
- $obj = $this->factory->createInstance($this->context);
-
- $this->assertIsa($obj, "WactConfigRegistryFactoryTester");
- $this->assertEqual($obj->optional, 'bar');
- }
-
- function testForcingOptionalToBeRequiredNumeric() {
- $this->context->setReturnValue('get', 'bar', array('optional_type'));
-
- $this->factory
- ->asClass('WactConfigRegistryFactoryTester')
- ->parameterRequired(1);
- $obj = $this->factory->createInstance($this->context);
-
- $this->assertIsa($obj, "WactConfigRegistryFactoryTester");
- $this->assertEqual($obj->optional, 'bar');
- }
-
- function testCreatingClassWithPropertyValue() {
- $this->factory
- ->asClass('WactConfigRegistryFactoryTester')
- ->propertyValue('prop', 'foo');
- $obj = $this->factory->createInstance($this->context);
-
- $this->assertIsa($obj, "WactConfigRegistryFactoryTester");
- $this->assertEqual($obj->prop, 'foo');
- }
-
- function testCreatingClassWithPropertyType() {
- $this->context->setReturnValue('get', 'bar', array('foo'));
-
- $this->factory
- ->asClass('WactConfigRegistryFactoryTester')
- ->propertyType('prop', 'foo');
- $obj = $this->factory->createInstance($this->context);
-
- $this->assertIsa($obj, "WactConfigRegistryFactoryTester");
- $this->assertEqual($obj->prop, 'bar');
- }
-
- function testForcingPropertyToBeRequired() {
- $this->context->setReturnValue('get', 'bar', array('prop_type'));
-
- $this->factory
- ->asClass('WactConfigRegistryFactoryTester')
- ->propertyRequired('prop');
- $obj = $this->factory->createInstance($this->context);
-
- $this->assertIsa($obj, "WactConfigRegistryFactoryTester");
- $this->assertEqual($obj->prop, 'bar');
- }
-
- function testCreatingClassWithSetterValue() {
- $this->factory
- ->asClass('WactConfigRegistryFactoryTester')
- ->setterValue('setValue', 'foo');
- $obj = $this->factory->createInstance($this->context);
-
- $this->assertIsa($obj, "WactConfigRegistryFactoryTester");
- $this->assertEqual($obj->value, 'foo');
- }
-
- function testCreatingClassWithSetterType() {
- $this->context->setReturnValue('get', 'bar', array('foo'));
-
- $this->factory
- ->asClass('WactConfigRegistryFactoryTester')
- ->setterType('setValue', 'foo');
- $obj = $this->factory->createInstance($this->context);
-
- $this->assertIsa($obj, "WactConfigRegistryFactoryTester");
- $this->assertEqual($obj->value, 'bar');
- }
-
- function testForcingSetterToBeRequired() {
- $this->context->setReturnValue('get', 'bar', array('value_type'));
-
- $this->factory
- ->asClass('WactConfigRegistryFactoryTester')
- ->setterRequired('setValue');
- $obj = $this->factory->createInstance($this->context);
-
- $this->assertIsa($obj, "WactConfigRegistryFactoryTester");
- $this->assertEqual($obj->value, 'bar');
- }
-
- function testCreatingClassWithSetterValueShortcut() {
- $this->factory
- ->asClass('WactConfigRegistryFactoryTester')
- ->setValue('foo');
- $obj = $this->factory->createInstance($this->context);
-
- $this->assertIsa($obj, "WactConfigRegistryFactoryTester");
- $this->assertEqual($obj->value, 'foo');
- }
-
- function testCreatingClassWithSetterTypeShortcut() {
- $this->context->setReturnValue('get', 'bar', array('value_type'));
-
- $this->factory
- ->asClass('WactConfigRegistryFactoryTester')
- ->setValue();
- $obj = $this->factory->createInstance($this->context);
-
- $this->assertIsa($obj, "WactConfigRegistryFactoryTester");
- $this->assertEqual($obj->value, 'bar');
- }
-
-}
-?>
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <Jef...@us...> - 2009-05-23 18:27:38
|
Revision: 970
http://wact.svn.sourceforge.net/wact/?rev=970&view=rev
Author: JeffMoore
Date: 2009-05-23 18:27:32 +0000 (Sat, 23 May 2009)
Log Message:
-----------
fix botcched rename
Removed Paths:
-------------
trunk/Wact/Config/Registry/factory.inc.php
Deleted: trunk/Wact/Config/Registry/factory.inc.php
===================================================================
--- trunk/Wact/Config/Registry/factory.inc.php 2009-05-23 18:26:13 UTC (rev 969)
+++ trunk/Wact/Config/Registry/factory.inc.php 2009-05-23 18:27:32 UTC (rev 970)
@@ -1,507 +0,0 @@
-<?php
-/**
- * Web Application Component Toolkit
- *
- * @link http://www.phpwact.org/
- *
- * @author Wact Development Team
- * @link http://www.phpwact.org/team
- *
- * @copyright Copyright 2006, Jeff Moore
- * @license http://opensource.org/licenses/mit-license.php MIT
- */
-
-/**
- * DSL for creating instances of types
- */
-class Wact_Config_Registry_Factory {
-
- /**
- * The beginning state of the DSL
- */
- const MODE_DEFAULT = 0;
-
- /**
- * We're defining a class
- */
- const MODE_CLASS = 1;
-
- /**
- * We're defining an alias
- */
- const MODE_TYPE = 2;
-
- /**
- * We're defining a simple value
- */
- const MODE_VALUE = 3;
-
- /**
- * Internal type description designation meaning, use default type
- */
- const USE_DEFAULT_TYPE = 1;
-
- /**
- * Current state of the DSL
- * @var MODE_CLASS|MODE_TYPE|MODE_DEFAULT
- */
- protected $mode = self::MODE_DEFAULT;
-
- /**
- * @var string
- */
- protected $class = 'StdClass';
-
- /**
- * @var string
- */
- protected $alias;
-
- /**
- * @var mixed
- */
- protected $value;
-
- /**
- * @var Wact_Reflection_Class
- */
- protected $classReflection;
-
- /**
- * @var array of Wact_Reflection_Parameter
- */
- protected $parameterDefs;
-
- /**
- * @var array
- */
- protected $parameterValues = array();
-
- /**
- * @var array
- */
- protected $parameterTypes = array();
-
- /**
- * @var array of Wact_Reflection_Parameter
- */
- protected $setterDefs;
-
- /**
- * @var array
- */
- protected $setterValues = array();
-
- /**
- * @var array
- */
- protected $setterTypes = array();
-
- /**
- * @var array of Wact_Reflection_Parameter
- */
- protected $propertyDefs;
-
- /**
- * @var array
- */
- protected $propertyValues = array();
-
- /**
- * @var array
- */
- protected $propertyTypes = array();
-
- /**
- * Are changes allowed to the definition of this factory?
- * @var boolean
- */
- protected $locked = FALSE;
-
- /**
- * Lock this factory definition from further changes.
- * @return Wact_Config_Registry_Factory for fluent interface
- */
- public function lock() {
- $this->locked = TRUE;
- return $this; // Stay fluent
- }
-
- /**
- * Protect against changing a locked definition
- */
- protected function requireClassModeForChange() {
- if ($this->mode !== self::MODE_CLASS) {
- throw new Wact_Config_Exception('Cannot describe class construction on a non-class factory');
- }
- if ($this->locked) {
- throw new Wact_Config_Exception('Attempt to change locked factory definition');
- }
- }
-
- /**
- * Protect against changing a locked definition
- */
- protected function requireDefaultModeForChange() {
- if ($this->mode !== self::MODE_DEFAULT) {
- throw new Wact_Config_Exception('Cannot redefine factory');
- }
- if ($this->locked) {
- throw new Wact_Config_Exception('Attempt to change locked factory definition');
- }
- }
-
- /**
- * Set the class that this factory will create.
- * @param string $class
- * @return Wact_Config_Registry_Factory for fluent interface
- */
- public function asClass($class) {
- $this->requireDefaultModeForChange();
- $this->class = $class;
- $this->mode = self::MODE_CLASS;
- return $this; // Stay fluent
- }
-
- /**
- * Set an alias to a different type
- * @param string $type
- * @return Wact_Config_Registry_Factory for fluent interface
- */
- public function asAliasToType($type) {
- $this->requireDefaultModeForChange();
- $this->alias = $type;
- $this->mode = self::MODE_TYPE;
- return $this; // Stay fluent
- }
-
- /**
- * Use a specific value
- * @param string $type
- * @return Wact_Config_Registry_Factory for fluent interface
- */
- public function asValue($value) {
- $this->requireDefaultModeForChange();
- $this->value = $value;
- $this->mode = self::MODE_VALUE;
- return $this; // Stay fluent
- }
-
- /**
- * Define a value to be injected for a specific constructor parameter
- *
- * @param string $name
- * @param mixed $value
- * @return Wact_Config_Registry_Factory for fluent interface
- */
- public function parameterValue($name, $value) {
- $this->requireClassModeForChange();
- $this->parameterValues[$name] = $value;
- unset($this->parameterTypes[$name]);
- return $this; // Stay fluent
- }
-
- /**
- * define the type of a specific constructor parameter
- *
- * @param string $name
- * @param string $type
- * @return Wact_Config_Registry_Factory for fluent interface
- */
- public function parameterType($name, $type) {
- $this->requireClassModeForChange();
- $this->parameterTypes[$name] = (string) $type;
- unset($this->parameterValues[$name]);
- return $this; // Stay fluent
- }
-
- /**
- * Indicate that injecting a specific parameter is required
- *
- * @param string $name
- * @return Wact_Config_Registry_Factory for fluent interface
- */
- public function parameterRequired($name) {
- $this->requireClassModeForChange();
- $this->parameterTypes[$name] = self::USE_DEFAULT_TYPE;
- unset($this->parameterValues[$name]);
- return $this; // Stay fluent
- }
-
- /**
- * Define a value to be injected for a specific property
- *
- * @param string $name
- * @param mixed $value
- * @return Wact_Config_Registry_Factory for fluent interface
- */
- public function propertyValue($name, $value) {
- $this->requireClassModeForChange();
- $this->propertyValues[$name] = $value;
- unset($this->propertyTypes[$name]);
- return $this; // Stay fluent
- }
-
- /**
- * define the type of a specific property
- *
- * @param string $name
- * @param string $type
- * @return Wact_Config_Registry_Factory for fluent interface
- */
- public function propertyType($name, $type) {
- $this->requireClassModeForChange();
- $this->propertyTypes[$name] = (string) $type;
- unset($this->propertyValues[$name]);
- return $this; // Stay fluent
- }
-
- /**
- * Indicate that injecting a specific property is required
- *
- * @param string $name
- * @return Wact_Config_Registry_Factory for fluent interface
- */
- public function propertyRequired($name) {
- $this->requireClassModeForChange();
- $this->propertyTypes[$name] = self::USE_DEFAULT_TYPE;
- unset($this->propertyValues[$name]);
- return $this; // Stay fluent
- }
-
- /**
- * Define a value to be injected for a specific setter
- *
- * @param string $name
- * @param mixed $value
- * @return Wact_Config_Registry_Factory for fluent interface
- */
- public function setterValue($name, $value) {
- $this->requireClassModeForChange();
- $this->setterValues[$name] = $value;
- unset($this->setterTypes[$name]);
- return $this; // Stay fluent
- }
-
- /**
- * define the type of a specific setter parameter
- *
- * @param string $name
- * @param string $type
- * @return Wact_Config_Registry_Factory for fluent interface
- */
- public function setterType($name, $type) {
- $this->requireClassModeForChange();
- $this->setterTypes[$name] = (string) $type;
- unset($this->setterValues[$name]);
- return $this; // Stay fluent
- }
-
- /**
- * define the type of a specific setter parameter
- *
- * @param string $name
- * @return Wact_Config_Registry_Factory for fluent interface
- */
- public function setterRequired($name) {
- $this->requireClassModeForChange();
- $this->setterTypes[$name] = self::USE_DEFAULT_TYPE;
- unset($this->setterValues[$name]);
- return $this; // Stay fluent
- }
-
- /**
- * define a setter injection value
- *
- * @param string $method
- * @param array $args
- * @return Wact_Config_Registry_Factory for fluent interface
- */
- public function __call($method, $args) {
- if (count($args) > 1) {
- throw new Wact_Config_Exception('Only one parameter is allowed per setter');
- }
- if (empty($args)) {
- $this->setterRequired($method);
- } else {
- $this->setterValue($method, array_shift($args));
- }
- return $this; // Stay fluent
- }
-
- /**
- * Lazy load and cache a Wact_Reflection_Class object
- * @return Wact_Reflection_Class
- */
- protected function getClassReflection() {
-
- // Lazy loading allows us to create factories without unecessarily
- // invoking reflection API.
- if (empty($this->classReflection)) {
- $this->classReflection = new Wact_Reflection_Class($this->class);
- }
-
- return $this->classReflection;
- }
-
- /**
- * Lazy load and cache a list of constructor parameters definitions
- * @return array
- */
- protected function getParameterDefinitions() {
- if (!isset($this->parameterDefs)) {
- $constructorInfo = $this->getClassReflection()->getConstructor();
- if ($constructorInfo) {
- $this->parameterDefs = $constructorInfo->getParameters();
- } else {
- $this->parameterDefs = array();
- }
- }
- return $this->parameterDefs;
- }
-
- /**
- * Accept a list of constructor arguments and extend it out by
- * injecting required parameters that were not specified.
- * @param Wact_Config_Registry $context
- * @param array $args a list of supplied arguments
- * @return array a full list of argument values to call
- */
- protected function buildParameters($context, $args) {
- $info = $this->getParameterDefinitions();
-
- // Only inject unspecified constructor parameters
- for( $i = count($args); $i < count($info); $i++) {
- $name = $info[$i]->getName();
- if (isset($this->parameterValues[$i])) {
- $args[$i] = isset($this->parameterValues[$i]);
- continue;
- } else if (isset($this->parameterValues[$name])) {
- $args[$i] = $this->parameterValues[$name];
- continue;
- } else if (isset($this->parameterTypes[$i])) {
- $type = $this->parameterTypes[$i];
- } else if (isset($this->parameterTypes[$name])) {
- $type = $this->parameterTypes[$name];
- } else if ($info[$i]->isOptional()) {
- continue;
- } else {
- $type = self::USE_DEFAULT_TYPE;
- }
- if ($type === self::USE_DEFAULT_TYPE) {
- $type = $info[$i]->getType();
- }
- if ($type) {
- $args[$i] = $context->get($type);
- } else {
- throw new Wact_Config_Exception(
- 'Cannot determine value to inject for "{class}" constructor parameter {parameter}',
- $this->class,
- $info[$i]->getName());
- }
- }
- return $args;
- }
-
- /**
- * Inject properties into an object instance
- *
- * @param Wact_Config_Registry $context
- * @param object $obj
- */
- protected function injectProperties($context, $obj) {
- foreach($this->propertyValues as $property => $value) {
- $obj->$property = $value;
- }
- if (empty($this->propertyTypes)) {
- return;
- }
- foreach($this->propertyTypes as $property => $type) {
- if ($type === self::USE_DEFAULT_TYPE) {
- $type = $this->getClassReflection()->getProperty($property)->getType();
- $this->propertyTypes[$property] = $type; // Cache it
- }
- if ($type) {
- $obj->$property = $context->get($type);
- } else {
- throw new Wact_Config_Exception(
- 'Cannot determine value to inject for "{class}" property {property}',
- $this->class,
- $property);
- }
- }
- }
-
- /**
- * Inject Values with Setters into an object instance
- *
- * @param Wact_Config_Registry $context
- * @param object $obj
- */
- protected function injectSetters($context, $obj) {
- foreach($this->setterValues as $setter => $value) {
- $obj->$setter($value);
- }
- if (empty($this->setterTypes)) {
- return;
- }
- foreach($this->setterTypes as $setter => $type) {
- if ($type === self::USE_DEFAULT_TYPE) {
- $method = $this->getClassReflection()->getMethod($setter);
- if ($method && ($params = $method->getParameters()) && ($param = array_shift($params)) && $param) {
- $type = $param->getType();
- } else {
- $type = FALSE;
- }
- $this->setterTypes[$setter] = $type; // Cache it
- }
- if ($type) {
- $obj->$setter($context->get($type));
- } else {
- throw new Wact_Config_Exception(
- 'Cannot determine value to inject for "{class}" setter {setter}',
- $this->class,
- $setter);
- }
- }
- }
-
- /**
- * Create an instance of an object using the parent registry to complete
- * missing constructor parameters.
- * @param Wact_Config_Registry $context
- * @param array $parameters a list of partially specified constructor params
- * @return mixed
- */
- public function createInstance($context, $parameters = array()) {
- $this->locked = TRUE;
- if ($this->mode == self::MODE_TYPE) {
- return $context->get($this->alias, $parameters);
- }
- if ($this->mode == self::MODE_VALUE) {
- return $this->value;
- }
- if (!class_exists($this->class)) {
- throw new Wact_Config_Exception('Class "{type}" does not exist', $this->class);
- }
-
- if ($this->getClassReflection()->isAbstract()) {
- throw new Wact_Config_Exception('Cannot instantiate abstract type "{type}"', $this->class);
- }
-
- $args = $this->buildParameters($context, $parameters);
- if (empty($args)) {
- $obj = $this->getClassReflection()->newInstance();
- } else {
- $obj = $this->getClassReflection()->newInstanceArgs($args);
- }
-
- $this->injectProperties($context, $obj);
- $this->injectSetters($context, $obj);
-
- return $obj;
- }
-
-}
-
-?>
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <Jef...@us...> - 2009-05-23 18:26:13
|
Revision: 969
http://wact.svn.sourceforge.net/wact/?rev=969&view=rev
Author: JeffMoore
Date: 2009-05-23 18:26:13 +0000 (Sat, 23 May 2009)
Log Message:
-----------
fix botched rename
Removed Paths:
-------------
trunk/Wact/Cache/Store/eaccelerator.test.php
Deleted: trunk/Wact/Cache/Store/eaccelerator.test.php
===================================================================
--- trunk/Wact/Cache/Store/eaccelerator.test.php 2009-05-23 18:26:00 UTC (rev 968)
+++ trunk/Wact/Cache/Store/eaccelerator.test.php 2009-05-23 18:26:13 UTC (rev 969)
@@ -1,23 +0,0 @@
-<?php
-require_once 'wact/cache/store.test.inc.php';
-
-class WactEacceleratorCacheTestCase extends WactCacheTestCase {
-
- protected $cache;
-
- function setUp() {
- clearstatcache();
- $this->cache = new Wact_Cache_Store_Eaccelerator();
- }
-
- function tearDown() {
- $this->cache->clear();
- }
-
- function skip() {
- $this->skipUnless(extension_loaded('eaccelerator') && ini_get('eaccelerator.enable'));
- }
-
-}
-
-?>
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <Jef...@us...> - 2009-05-23 18:26:01
|
Revision: 968
http://wact.svn.sourceforge.net/wact/?rev=968&view=rev
Author: JeffMoore
Date: 2009-05-23 18:26:00 +0000 (Sat, 23 May 2009)
Log Message:
-----------
fix botched rename
Removed Paths:
-------------
trunk/Wact/Cache/Store/apc.test.php
Deleted: trunk/Wact/Cache/Store/apc.test.php
===================================================================
--- trunk/Wact/Cache/Store/apc.test.php 2009-05-23 18:25:18 UTC (rev 967)
+++ trunk/Wact/Cache/Store/apc.test.php 2009-05-23 18:26:00 UTC (rev 968)
@@ -1,23 +0,0 @@
-<?php
-require_once 'wact/cache/store.test.inc.php';
-
-class WactApcCacheTestCase extends WactCacheTestCase {
-
- protected $cache;
-
- function setUp() {
- clearstatcache();
- $this->cache = new Wact_Cache_Store_Apc();
- }
-
- function tearDown() {
- $this->cache->clear();
- }
-
- function skip() {
- $this->skipUnless(extension_loaded('apc') && ini_get('apc.enabled'));
- }
-
-}
-
-?>
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <Jef...@us...> - 2009-05-23 18:25:25
|
Revision: 967
http://wact.svn.sourceforge.net/wact/?rev=967&view=rev
Author: JeffMoore
Date: 2009-05-23 18:25:18 +0000 (Sat, 23 May 2009)
Log Message:
-----------
fix botched rename
Removed Paths:
-------------
trunk/Wact/Cache/Store/transient.test.php
Deleted: trunk/Wact/Cache/Store/transient.test.php
===================================================================
--- trunk/Wact/Cache/Store/transient.test.php 2009-05-23 18:25:08 UTC (rev 966)
+++ trunk/Wact/Cache/Store/transient.test.php 2009-05-23 18:25:18 UTC (rev 967)
@@ -1,20 +0,0 @@
-<?php
-
-require_once 'wact/cache/store.test.inc.php';
-
-class WactTransientCacheTestCase extends WactCacheTestCase {
-
- protected $cache;
-
- function setUp() {
- clearstatcache();
- $this->cache = new Wact_Cache_Store_Transient();
- }
-
- function tearDown() {
- $this->cache->clear();
- }
-
-}
-
-?>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <Jef...@us...> - 2009-05-23 18:25:13
|
Revision: 966
http://wact.svn.sourceforge.net/wact/?rev=966&view=rev
Author: JeffMoore
Date: 2009-05-23 18:25:08 +0000 (Sat, 23 May 2009)
Log Message:
-----------
fix botched rename
Removed Paths:
-------------
trunk/Wact/Cache/Store/transient.inc.php
Deleted: trunk/Wact/Cache/Store/transient.inc.php
===================================================================
--- trunk/Wact/Cache/Store/transient.inc.php 2009-05-23 18:24:52 UTC (rev 965)
+++ trunk/Wact/Cache/Store/transient.inc.php 2009-05-23 18:25:08 UTC (rev 966)
@@ -1,113 +0,0 @@
-<?php
-/**
-* Web Application Component Toolkit
-*
-* @link http://www.phpwact.org/
-*
-* @author Wact Development Team
-* @link http://www.phpwact.org/team
-*
-* @copyright Copyright 2006, Jeff Moore
-* @license http://opensource.org/licenses/mit-license.php MIT
-*/
-
-/**
-* A transient cache. This object caches data items until the end of the
-* current request.
-*/
-class Wact_Cache_Store_Transient implements Wact_Cache_Store {
-
- /**
- * A hash table of the items stored in this cache.
- * @var array
- */
- protected $items = array();
-
- /**
- * @see Wact_Cache_Store.store
- */
- public function store($key, $data, $lifetime = NULL) {
- if ($lifetime !== NULL && $lifetime !== 0) {
- throw new Wact_Cache_Exception(
- 'Wact_Cache_Store_Transient does not support expiring');
- }
- settype($key, 'string');
- $this->items[$key] = (string) $data;
- return TRUE;
- }
-
- /**
- * @see Wact_Cache_Store.storeValue
- */
- public function storeValue($key, $data, $lifetime = NULL) {
- if ($lifetime !== NULL && $lifetime !== 0) {
- throw new Wact_Cache_Exception(
- 'Wact_Cache_Store_Transient does not support expiring');
- }
- settype($key, 'string');
- $this->items[$key] = $data;
- return TRUE;
- }
-
- /**
- * @see Wact_Cache_Store.fetch
- */
- public function fetch($key, $default = NULL) {
- settype($key, 'string');
- if (isset($this->items[$key])) {
- return (string) $this->items[$key];
- } else {
- return $default;
- }
- }
-
- /**
- * @see Wact_Cache_Store.fetch
- */
- public function fetchValue($key, $default = NULL) {
- settype($key, 'string');
- if (isset($this->items[$key])) {
- return $this->items[$key];
- } else {
- return $default;
- }
- }
-
- /**
- * @see Wact_Cache_Store.includeCode
- */
- public function includeCode($key) {
- settype($key, 'string');
- if (isset($this->items[$key])) {
- // Strange concatination works better with source code parsing tools
- $result = eval(' ?' . '>' . $this->items[$key] . '<' . '?php ');
-
- if (is_null($result)) {
- return TRUE;
- } else {
- return $result;
- }
- }
- return FALSE;
- }
-
- /**
- * @see Wact_Cache_Store.remove
- */
- public function remove($key) {
- settype($key, 'string');
- unset($this->items[$key]);
- return TRUE;
- }
-
- /**
- * @see Wact_Cache_Store.clear
- */
- public function clear() {
- $this->items = array();
- return TRUE;
- }
-
-}
-
-?>
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <Jef...@us...> - 2009-05-23 18:24:57
|
Revision: 965
http://wact.svn.sourceforge.net/wact/?rev=965&view=rev
Author: JeffMoore
Date: 2009-05-23 18:24:52 +0000 (Sat, 23 May 2009)
Log Message:
-----------
fix botched rename
Removed Paths:
-------------
trunk/Wact/Cache/Store/null.inc.php
Deleted: trunk/Wact/Cache/Store/null.inc.php
===================================================================
--- trunk/Wact/Cache/Store/null.inc.php 2009-05-23 18:24:40 UTC (rev 964)
+++ trunk/Wact/Cache/Store/null.inc.php 2009-05-23 18:24:52 UTC (rev 965)
@@ -1,70 +0,0 @@
-<?php
-/**
-* Web Application Component Toolkit
-*
-* @link http://www.phpwact.org/
-*
-* @author Wact Development Team
-* @link http://www.phpwact.org/team
-*
-* @copyright Copyright 2006, Jeff Moore
-* @license http://opensource.org/licenses/mit-license.php MIT
-*/
-
-/**
-*The Null cache. Always reports cache misses
-*/
-class Wact_Cache_Store_Null implements Wact_Cache_Store {
-
- /**
- * @see Wact_Cache_Store.store
- */
- public function store($key, $data, $lifetime = NULL) {
- return TRUE;
- }
-
- /**
- * @see Wact_Cache_Store.storeValue
- */
- public function storeValue($key, $data, $lifetime = NULL) {
- return TRUE;
- }
-
- /**
- * @see Wact_Cache_Store.fetch
- */
- public function fetch($key, $default = NULL) {
- return $default;
- }
-
- /**
- * @see Wact_Cache_Store.fetch
- */
- public function fetchValue($key, $default = NULL) {
- return $default;
- }
-
- /**
- * @see Wact_Cache_Store.includeCode
- */
- public function includeCode($key) {
- return FALSE;
- }
-
- /**
- * @see Wact_Cache_Store.remove
- */
- public function remove($key) {
- return TRUE;
- }
-
- /**
- * @see Wact_Cache_Store.clear
- */
- public function clear() {
- return TRUE;
- }
-
-}
-
-?>
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <Jef...@us...> - 2009-05-23 18:24:47
|
Revision: 964
http://wact.svn.sourceforge.net/wact/?rev=964&view=rev
Author: JeffMoore
Date: 2009-05-23 18:24:40 +0000 (Sat, 23 May 2009)
Log Message:
-----------
fix botched rename
Removed Paths:
-------------
trunk/Wact/Cache/Store/file.test.php
Deleted: trunk/Wact/Cache/Store/file.test.php
===================================================================
--- trunk/Wact/Cache/Store/file.test.php 2009-05-23 18:24:29 UTC (rev 963)
+++ trunk/Wact/Cache/Store/file.test.php 2009-05-23 18:24:40 UTC (rev 964)
@@ -1,41 +0,0 @@
-<?php
-
-require_once 'wact/cache/store.test.inc.php';
-
-class WactFileCacheTestCase extends WactCacheTestCase {
-
- protected $cache;
-
- function setUp() {
- clearstatcache();
- $this->cache = new Wact_Cache_Store_File();
- }
-
- function tearDown() {
- $this->cache->clear();
- }
-
- function testGetLocation() {
- $this->assertNotEqual($this->cache->getLocation(), NULL);
- }
-
- function testStoreOverwriteDirectoryWithFileError() {
- $this->cache->store('path/test', 'data');
- $this->assertFalse($this->cache->store('path', 'bad data'));
- }
-
- function testStoreOverwriteFileWithDirectoryError() {
- $this->cache->store('path', 'data');
-
- // This would cause overwriting a directory with a file
- $this->assertFalse($this->cache->store('path/test', 'bad data'));
- }
-
- function testRemoveError() {
- $this->cache->store('path/test', 'data');
- $this->assertFalse($this->cache->remove('path'));
- }
-
-}
-
-?>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <Jef...@us...> - 2009-05-23 18:24:40
|
Revision: 963
http://wact.svn.sourceforge.net/wact/?rev=963&view=rev
Author: JeffMoore
Date: 2009-05-23 18:24:29 +0000 (Sat, 23 May 2009)
Log Message:
-----------
fix botched rename
Removed Paths:
-------------
trunk/Wact/Cache/Store/file.inc.php
Deleted: trunk/Wact/Cache/Store/file.inc.php
===================================================================
--- trunk/Wact/Cache/Store/file.inc.php 2009-05-23 18:24:14 UTC (rev 962)
+++ trunk/Wact/Cache/Store/file.inc.php 2009-05-23 18:24:29 UTC (rev 963)
@@ -1,192 +0,0 @@
-<?php
-/**
-* Web Application Component Toolkit
-*
-* @link http://www.phpwact.org/
-*
-* @author Wact Development Team
-* @link http://www.phpwact.org/team
-*
-* @copyright Copyright 2006, Jeff Moore
-* @license http://opensource.org/licenses/mit-license.php MIT
-*/
-
-/**
-* A file based cache.
-*/
-class Wact_Cache_Store_File implements Wact_Cache_Store {
-
- /**
- * The directory used to hold the cached information.
- * @var string
- */
- protected $location;
-
- /**
- * object constructor
- * @param string location Directory used to store the cached data.
- */
- public function __construct($location = '/tmp/wact') {
- $this->location = $location;
- }
-
- /**
- * Transform a cache key into a filename
- * @param string id cache id
- * @return string file name
- */
- public function getFilenameFromKey($key) {
-
- // We must be careful not to transform different keys to identical
- // Filenames
-
- // We also want to transform illegal or annoying characters
-
- // What do we do about illegal file name lengths? Exception?
- // (Unix = 256 char, OS X = 151)
-
- // Windows characters are irrelevant here because this class
- // requires unix file system semantics that windows does not support.
-
- $illegal = array(
- '%' => '%%', // distinguish real % chars from our escape codes
- chr(0) => '%0', // illegal for unix
- ':' => '%1', // illegal on Mac OS X
- );
-
- $filename = $this->location . DIRECTORY_SEPARATOR . strtr( $key, $illegal );
-
- return $filename;
- }
-
- /**
- * Returns the directory where the cached data is stored.
- * @return string Directory
- */
- public function getLocation() {
- return $this->location;
- }
-
- /**
- * Remove all files and subdirectories in the specified directory.
- * The top level directory is not itself deleted.
- * @param string dirname directory
- */
- protected function removeDirectoryContents($dirname) {
-
- if (is_dir($dirname)) {
- if ($dh = opendir($dirname)) {
- while ($file = readdir($dh)) {
- if ($file=='.' || $file=='..') {
- continue;
- }
-
- $item = $dirname . '/' . $file;
- if (is_dir($item)) {
- $this->removeDirectoryContents($item);
- rmdir($item);
- }
- if (is_file($item)) {
- unlink($item);
- }
- }
- closedir($dh);
- }
- }
- }
-
- /**
- * @see Wact_Cache_Store.store
- */
- public function store($key, $data, $lifetime = NULL) {
-
- if ($lifetime !== NULL && $lifetime !== 0) {
- throw new Wact_Cache_Exception(
- 'Wact_Cache_Store_File does not support expiring');
- }
-
- settype($key, 'string');
-
- $filename = $this->getFilenameFromKey($key);
- $dir = dirname($filename);
-
- // This technique provides atomic read and write operations under unix
- // without locking
-
- if ((!is_dir($dir) && !@mkdir($dir, 0777, TRUE)) ||
- !($tmpfile = @tempnam($dir, '.tmp')) ||
- !@file_put_contents($tmpfile, $data) ||
- !@rename($tmpfile, $filename)) {
- return FALSE;
- }
- return TRUE;
- }
-
- /**
- * @see Wact_Cache_Store.storeValue
- */
- public function storeValue($key, $data, $lifetime = NULL) {
- return $this->store($key, serialize($data), $lifetime);
- }
-
- /**
- * @see Wact_Cache_Store.fetch
- */
- public function fetch($key, $default = NULL) {
- settype($key, 'string');
- $filename = $this->getFilenameFromKey($key);
- $result = @file_get_contents($filename);
- if ($result === FALSE) {
- return $default;
- }
- return $result;
- }
-
- /**
- * @see Wact_Cache_Store.fetchValue
- */
- public function fetchValue($key, $default = NULL) {
- $result = $this->fetch($key, FALSE);
- if ($result === FALSE) {
- return $default;
- }
- return unserialize($result);
- }
-
- /**
- * @see Wact_Cache_Store.includeCode
- */
- public function includeCode($key) {
- settype($key, 'string');
- $filename = $this->getFilenameFromKey($key);
- $errorlevel = error_reporting();
- error_reporting($errorlevel & ~E_WARNING);
- $result = include_once($filename);
- error_reporting($errorlevel);
- return $result;
- }
-
- /**
- * @see Wact_Cache_Store.remove
- */
- public function remove($key) {
- settype($key, 'string');
-
- $filename = $this->getFilenameFromKey($key);
- if (file_exists($filename) && !@unlink($filename)) {
- return FALSE;
- }
- return TRUE;
- }
-
- /**
- * @see Wact_Cache_Store.clear
- */
- public function clear() {
- $this->removeDirectoryContents($this->location);
- return TRUE;
- }
-
-}
-
-?>
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <Jef...@us...> - 2009-05-23 18:24:18
|
Revision: 962
http://wact.svn.sourceforge.net/wact/?rev=962&view=rev
Author: JeffMoore
Date: 2009-05-23 18:24:14 +0000 (Sat, 23 May 2009)
Log Message:
-----------
fix botched rename
Removed Paths:
-------------
trunk/Wact/Cache/Store/eaccelerator.inc.php
Deleted: trunk/Wact/Cache/Store/eaccelerator.inc.php
===================================================================
--- trunk/Wact/Cache/Store/eaccelerator.inc.php 2009-05-23 18:23:54 UTC (rev 961)
+++ trunk/Wact/Cache/Store/eaccelerator.inc.php 2009-05-23 18:24:14 UTC (rev 962)
@@ -1,102 +0,0 @@
-<?php
-/**
-* Web Application Component Toolkit
-*
-* @link http://www.phpwact.org/
-*
-* @author Wact Development Team
-* @link http://www.phpwact.org/team
-*
-* @copyright Copyright 2006, Jeff Moore
-* @license http://opensource.org/licenses/mit-license.php MIT
-*/
-
-
-/**
-*/
-class Wact_Cache_Store_Eaccelerator implements Wact_Cache_Store {
-
- /**
- * Is the extension that supports this cache store available?
- */
- function isAvailable() {
- return extension_loaded('eaccelerator') && ini_get('eaccelerator.enable');
- }
-
- /**
- * @see Wact_Cache_Store.store
- */
- public function store($key, $data, $lifetime = NULL) {
- settype($key, 'string');
- return eaccelerator_put($key, (string) $data, $lifetime);
- }
-
- /**
- * @see Wact_Cache_Store.storeValue
- */
- public function storeValue($key, $data, $lifetime = NULL) {
- return $this->store($key, serialize($data), $lifetime);
- }
-
- /**
- * @see Wact_Cache_Store.fetch
- */
- public function fetch($key, $default = NULL) {
- settype($key, 'string');
- $result = eaccelerator_get($key);
- if ($result === NULL) {
- return $default;
- } else {
- return $result;
- }
- }
-
- /**
- * @see Wact_Cache_Store.fetch
- */
- public function fetchValue($key, $default = NULL) {
- $result = $this->fetch($key, FALSE);
- if ($result === FALSE) {
- return $default;
- }
- return unserialize($result);
- }
-
- /**
- * @see Wact_Cache_Store.includeCode
- */
- public function includeCode($key) {
- $code = $this->fetch($key, FALSE);
- if ($code !== FALSE) {
- // Strange concatination works better with source code parsing tools
- $result = eval(' ?' . '>' . $code . '<' . '?php ');
-
- if (is_null($result)) {
- return TRUE;
- } else {
- return $result;
- }
- }
- return FALSE;
- }
-
- /**
- * @see Wact_Cache_Store.remove
- */
- public function remove($key) {
- settype($key, 'string');
- return eaccelerator_rm($key);
- }
-
- /**
- * @see Wact_Cache_Store.clear
- */
- public function clear() {
- // requires higher privileges
- eaccelerator_Clear();
- return TRUE;
- }
-
-}
-
-?>
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <Jef...@us...> - 2009-05-23 18:24:03
|
Revision: 961
http://wact.svn.sourceforge.net/wact/?rev=961&view=rev
Author: JeffMoore
Date: 2009-05-23 18:23:54 +0000 (Sat, 23 May 2009)
Log Message:
-----------
fix botched rename
Removed Paths:
-------------
trunk/Wact/Cache/Store/apc.inc.php
Deleted: trunk/Wact/Cache/Store/apc.inc.php
===================================================================
--- trunk/Wact/Cache/Store/apc.inc.php 2009-05-23 18:21:38 UTC (rev 960)
+++ trunk/Wact/Cache/Store/apc.inc.php 2009-05-23 18:23:54 UTC (rev 961)
@@ -1,100 +0,0 @@
-<?php
-/**
-* Web Application Component Toolkit
-*
-* @link http://www.phpwact.org/
-*
-* @author Wact Development Team
-* @link http://www.phpwact.org/team
-*
-* @copyright Copyright 2006, Jeff Moore
-* @license http://opensource.org/licenses/mit-license.php MIT
-*/
-
-
-/**
-*/
-class Wact_Cache_Store_Apc implements Wact_Cache_Store {
-
- /**
- * Is the extension that supports this cache store available?
- */
- function isAvailable() {
- return extension_loaded('apc') && ini_get('apc.enabled');
- }
-
- /**
- * @see Wact_Cache_Store.store
- */
- public function store($key, $data, $lifetime = NULL) {
- settype($key, 'string');
- return apc_store($key, (string) $data, $lifetime);
- }
-
- /**
- * @see Wact_Cache_Store.storeValue
- */
- public function storeValue($key, $data, $lifetime = NULL) {
- return $this->store($key, serialize($data), $lifetime);
- }
-
- /**
- * @see Wact_Cache_Store.fetch
- */
- public function fetch($key, $default = NULL) {
- settype($key, 'string');
- $result = apc_fetch($key);
- if ($result === FALSE) {
- return $default;
- } else {
- return $result;
- }
- }
-
- /**
- * @see Wact_Cache_Store.fetch
- */
- public function fetchValue($key, $default = NULL) {
- $result = $this->fetch($key, FALSE);
- if ($result === FALSE) {
- return $default;
- }
- return unserialize($result);
- }
-
- /**
- * @see Wact_Cache_Store.includeCode
- */
- public function includeCode($key) {
- $code = $this->fetch($key, FALSE);
- if ($code !== FALSE) {
- // Strange concatination works better with source code parsing tools
- $result = eval(' ?' . '>' . $code . '<' . '?php ');
-
- if (is_null($result)) {
- return TRUE;
- } else {
- return $result;
- }
- }
- return FALSE;
- }
-
- /**
- * @see Wact_Cache_Store.remove
- */
- public function remove($key) {
- settype($key, 'string');
- return apc_delete($key);
- }
-
- /**
- * @see Wact_Cache_Store.clear
- */
- public function clear() {
- return apc_clear_cache('user');
- }
-
-}
-
-?>
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <Jef...@us...> - 2009-05-23 18:21:51
|
Revision: 960
http://wact.svn.sourceforge.net/wact/?rev=960&view=rev
Author: JeffMoore
Date: 2009-05-23 18:21:38 +0000 (Sat, 23 May 2009)
Log Message:
-----------
fixing botched rename
Removed Paths:
-------------
trunk/Wact/Exception/Formatter/html.test.php
Deleted: trunk/Wact/Exception/Formatter/html.test.php
===================================================================
--- trunk/Wact/Exception/Formatter/html.test.php 2009-05-23 18:21:24 UTC (rev 959)
+++ trunk/Wact/Exception/Formatter/html.test.php 2009-05-23 18:21:38 UTC (rev 960)
@@ -1,25 +0,0 @@
-<?php
-
-class WactHtmlExceptionMessageFormatterTestCase extends Wact_Test_Case {
-
- function testConvertToHtmlLeadingSpaces() {
- $message = ' Test';
- $result = Wact_Exception_Formatter_Html::convertToHtml($message);
- $this->assertEqual($result, ' Test');
- }
-
- function testConvertToHtmlIndentation() {
- $message = "Test:\n indent";
- $result = Wact_Exception_Formatter_Html::convertToHtml($message);
- $this->assertEqual($result, "Test:<br />\n indent");
- }
-
- function testConvertToHtmlIndentation4() {
- $message = "Test:\n indent";
- $result = Wact_Exception_Formatter_Html::convertToHtml($message);
- $this->assertEqual($result, "Test:<br />\n indent");
- }
-
-}
-
-?>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <Jef...@us...> - 2009-05-23 18:21:30
|
Revision: 959
http://wact.svn.sourceforge.net/wact/?rev=959&view=rev
Author: JeffMoore
Date: 2009-05-23 18:21:24 +0000 (Sat, 23 May 2009)
Log Message:
-----------
fixing botched rename
Removed Paths:
-------------
trunk/Wact/Exception/Formatter/html.inc.php
Deleted: trunk/Wact/Exception/Formatter/html.inc.php
===================================================================
--- trunk/Wact/Exception/Formatter/html.inc.php 2009-05-23 18:16:38 UTC (rev 958)
+++ trunk/Wact/Exception/Formatter/html.inc.php 2009-05-23 18:21:24 UTC (rev 959)
@@ -1,123 +0,0 @@
-<?php
-/**
-* Web Application Component Toolkit
-*
-* @link http://www.phpwact.org/
-*
-* @author Wact Development Team
-* @link http://www.phpwact.org/team
-*
-* @copyright Copyright 2006, Jeff Moore
-* @license http://opensource.org/licenses/mit-license.php MIT
-*/
-
-/**
-* Turn a console oriented exception message into an HTML message.
-*/
-class Wact_Exception_Formatter_Html extends Wact_Error_Formatter_Html_StackTrace implements Wact_Exception_Formatter {
-
- /**
- */
- static function replaceInternalSpaces($match) {
- return "\n" . str_repeat(' ', strlen($match[0]) - 1);
- }
-
- /**
- */
- static function replaceFirstSpaces($match) {
- return str_repeat(' ', strlen($match[0]));
- }
-
- /**
- */
- static function convertToHtml($message) {
- $message = htmlspecialchars($message);
- $message = preg_replace_callback('/^ +/',
- array(__CLASS__, 'replaceFirstSpaces'),
- $message);
- $message = preg_replace_callback('/\n +/',
- array(__CLASS__, 'replaceInternalSpaces'),
- $message);
- $message = nl2br($message);
- return $message;
- }
-
- /**
- */
- function beginException() {
- $this->message .= "<table style='color:black;background-color:white' border='1' cellspacing='0'>\n";
- }
-
- /**
- */
- function endException() {
- $this->message .= "</table>";
- }
-
- /**
- */
- function beginList() {
- $this->message .= "<ol>\n";
- }
-
- /**
- */
- function endList() {
- $this->message .= "</ol>";
- }
-
- /**
- */
- function beginListItem() {
- $this->message .= "<li>\n";
- }
-
- /**
- */
- function endListItem() {
- $this->message .= "</li>";
- }
-
- /**
- */
- function writeExceptionMessage($message, $file, $line, $class) {
- $this->message .= "<tr>\n";
- $this->message .= "<td bgcolor='#ff9999'>\n";
- $this->message .= '<b>' . $class . '</b> in <b>' . $file . '</b> '
- . 'on line <b>' . $line . "</b>\n";
- $this->message .= "<br />\n";
- $this->message .= htmlspecialchars($message) . "\n";
-
- $this->message .= "</td>\n";
- $this->message .= "</tr>\n";
- }
-
- /**
- */
- function beginChildSection($title) {
- $this->message .= "<tr><td bgcolor='#aaaaaa'><b>$title</b></td></tr>\n";
- $this->message .= "<tr>\n";
- $this->message .= "<td style='border-left-color:#aaaaaa;border-left-width:2em;'>\n";
- }
-
- /**
- */
- function endChildSection() {
- $this->message .= "</td>\n";
- $this->message .= "</tr>\n";
- }
-
- /**
- */
- function writeException($e) {
- if (method_exists($e, 'toHtml')) {
- $this->message .= $e->toHtml();
- } else {
- $this->message .= self::
- convertToHtml($e->__toString());
- }
- }
-
-}
-
-?>
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <Jef...@us...> - 2009-05-23 18:16:42
|
Revision: 958
http://wact.svn.sourceforge.net/wact/?rev=958&view=rev
Author: JeffMoore
Date: 2009-05-23 18:16:38 +0000 (Sat, 23 May 2009)
Log Message:
-----------
Removing botched renames
Removed Paths:
-------------
trunk/Wact/Html/Sax/handler.inc.php
trunk/Wact/Html/Sax/locator.inc.php
trunk/Wact/Html/Sax/parser.inc.php
trunk/Wact/Html/Sax/parser.test.php
Deleted: trunk/Wact/Html/Sax/handler.inc.php
===================================================================
--- trunk/Wact/Html/Sax/handler.inc.php 2009-05-23 18:13:10 UTC (rev 957)
+++ trunk/Wact/Html/Sax/handler.inc.php 2009-05-23 18:16:38 UTC (rev 958)
@@ -1,36 +0,0 @@
-<?php
-/**
-* Web Application Component Toolkit
-*
-* @link http://www.phpwact.org/
-*
-* @author Wact Development Team
-* @link http://www.phpwact.org/team
-*
-* @copyright Copyright 2006, Jeff Moore
-* @license http://opensource.org/licenses/mit-license.php MIT
-*/
-
-/**
-*/
-interface Wact_Html_Sax_Handler {
-
- function startDocument(Wact_Html_Sax_Locator $locator, $encoding);
-
- function endDocument();
-
- function characters($data);
-
- function startElement($name, $attrs);
-
- function endElement($name);
-
- function emptyElement($name, $attrs);
-
- function cdata($data);
-
- function comment($data);
-
-}
-
-?>
\ No newline at end of file
Deleted: trunk/Wact/Html/Sax/locator.inc.php
===================================================================
--- trunk/Wact/Html/Sax/locator.inc.php 2009-05-23 18:13:10 UTC (rev 957)
+++ trunk/Wact/Html/Sax/locator.inc.php 2009-05-23 18:16:38 UTC (rev 958)
@@ -1,28 +0,0 @@
-<?php
-/**
-* Web Application Component Toolkit
-*
-* @link http://www.phpwact.org/
-*
-* @author Wact Development Team
-* @link http://www.phpwact.org/team
-*
-* @copyright Copyright 2006, Jeff Moore
-* @license http://opensource.org/licenses/mit-license.php MIT
-*/
-
-/**
-*/
-interface Wact_Html_Sax_Locator {
- function getPublicId();
-
- function getLineNumber();
-
- function getColumnNumber();
-
- function getCharacterOffset();
-
- function getRawEventString();
-}
-
-?>
\ No newline at end of file
Deleted: trunk/Wact/Html/Sax/parser.inc.php
===================================================================
--- trunk/Wact/Html/Sax/parser.inc.php 2009-05-23 18:13:10 UTC (rev 957)
+++ trunk/Wact/Html/Sax/parser.inc.php 2009-05-23 18:16:38 UTC (rev 958)
@@ -1,276 +0,0 @@
-<?php
-/**
-* Web Application Component Toolkit
-*
-* @link http://www.phpwact.org/
-*
-* @author Wact Development Team
-* @link http://www.phpwact.org/team
-*
-* @copyright Copyright 2006, Jeff Moore
-* @license http://opensource.org/licenses/mit-license.php MIT
-*/
-
-/**
-* HTML/XHTML parser that robustly scans a text string and outputs a
-* stream of SAX events.
-*
-* This class is designed primarily to parse HTML fragments. Intended usage
-* scenarios include:
-* - A basis for santizing HTML strings
-* - Recognizing XML style markup embedded in text documents
-* - Implementing HTML-like markup languages
-*
-* This class emits events in a custom SAX API that is designed to represent
-* HTML documents as well as XML documents. However, this class should be geared
-* primarly to HTML markup.
-*
-* As a general strategy, markup events are emitted only for valid markup,
-* although sequence of events may not constitute a well-formed document.
-*
-* There is no current definition of what is valid HTML markup and what is not.
-* (The HTML 4.0.1 spec claims a relationship to the SGML specification which
-* is not helpful for this application.) The WHAT working group
-* (http://whatwg.org/) is working on such a specification and this parser
-* should track the parsing recommendations of that group as much as possible.
-*
-* If potential markup is encountered that the parser does not understand, it
-* is passed through in the form of character data.
-*
-* Entities are not parsed and instead passed through unaltered.
-* Character data and attribute values may contain the <, &, and > characters.
-* Minimized boolean attributes are allowed.
-* Attribute values without quotation marks are allowed.
-* Comments are parsed SGML style
-*
-* The text string to be parsed must be UTF-8.
-*
-* PHP CODE:
-* This parser has no knowledge of embedded PHP code. If you want to process
-* a document with embedded PHP code, use the php tokenizer to recognize the
-* php and replace it with unique entities. The entities can be replaced later
-* in the event stream. These entities may still cause problems for this parser
-* if they appear at places other than attribute values or character data.
-*/
-// Rename to reader
-class Wact_Html_Sax_Parser implements Wact_Html_Sax_Locator {
-
- /**
- * An identifier for this document
- */
- var $publicId;
-
- /**
- * A class observing content events emited by this parser.
- * @var Wact_Html_Sax_Handler event handler
- */
- var $handler = NULL;
-
- /**
- * text document being parsed
- * @var string
- */
- var $rawtext;
-
- /**
- * Current position in document relative to start (0)
- * @var int
- */
- var $position;
- var $charStart;
- var $markupStart;
-
- /**
- * Length of the document in characters
- * @var int
- */
- var $length;
-
-
- /**
- */
- function setHandler($obj) {
- $this->handler = $obj;
- }
-
- /**
- * Calculates the line number from the byte index
- * @return int the current line number
- */
- function getLineNumber() {
- return 1 + substr_count(substr($this->rawtext, 0, $this->position), "\n");
- }
-
- /**
- */
- function getPublicId() {
- return $this->publicId;
- }
-
- /**
- * Calculates the column number from the byte index
- * @return int the current line number
- */
- function getColumnNumber() {
- // Not implemented yet.
- }
-
- /**
- * emit characters event
- */
- function getCharacterOffset() {
- return $this->position;
- }
-
- /**
- *
- */
- function getRawEventString() {
- return substr($this->rawtext, $this->markupStart, $this->position-$this->markupStart);
- }
-
- /**
- * emit characters event
- */
- function emitCharacters() {
- if ($this->markupStart > $this->charStart) {
- $this->handler->characters(substr($this->rawtext, $this->charStart, $this->markupStart - $this->charStart));
- }
- $this->charStart = $this->position;
- }
-
- /**
- * Begins the parsing operation, setting up any decorators, depending on
- * parse options invoking _parse() to execute parsing
- * @param string XML document to parse
- * @return void
- */
- function parse($data, $publicId = NULL) {
- $this->rawtext = $data;
- $this->length = strlen($data);
- $this->position = 0;
- $this->charStart = 0;
- $this->publicId = $publicId;
-
- $this->handler->startDocument($this, 'UTF-8');
-
- $nameStartChar = ':_a-zA-Z\xC0-\xD6\xD8-\xF6\xF8-\x{2FF}\x{370}-\x{37D}\x{37F}-\x{1FFF}\x{200C}-\x{200D}\x{2070}-\x{218F}\x{2C00}-\x{2FEF}\x{3001}-\x{D7FF}\x{F900}-\x{FDCF}\x{FDF0}-\x{FFFD}';
- $nameChar = $nameStartChar . '-.0-9\x{b7}\x{0300}-\x{036f}\x{203f}-\x{2040}';
-
- $namePattern = '[' . $nameStartChar . '][' . $nameChar . ']*';
-
- $markupStartPattern = '/<\/|<!|<[' . $nameStartChar . ']/u';
- $endElementPattern = '/\G(' . $namePattern. ')\s*>/u';
- $startElementPattern = '/\G(' . $namePattern. ')(?=\s|>|\/>)/u';
- $startElementEndPattern = '/\G\s*(\/)?>/u';
- $attributePattern = '/\G\s*(' . $namePattern . ')(\s*=\s*("|\'|)(.*?)\3){0,1}(?=\s|\/>|>)/us';
- $commentPattern = '/\G--(.*?)--\s*/us';
- $commentDeclEndPattern ='/\G>/u';
-
- $cdataPattern = '/\G\[CDATA\[(.*)\]\]\>/us';
-
- do {
- if (!preg_match($markupStartPattern, $this->rawtext, $matches, PREG_OFFSET_CAPTURE, $this->position)) {
- break;
- }
-
- $this->markupStart = $matches[0][1];
- $this->position = $this->markupStart + 2;
-
- switch($matches[0][0]) {
- case '</':
- if (!preg_match($endElementPattern, $this->rawtext, $matches, PREG_OFFSET_CAPTURE, $this->position)) {
- break;
- }
-
- $tag = $matches[1][0];
- $this->position += strlen($matches[0][0]);
-
- $this->emitCharacters();
- $this->handler->endElement($tag);
-
- break;
- case '<!':
- if (preg_match_all($commentPattern, $this->rawtext, $matches, PREG_SET_ORDER, $this->position)) {
- $comments = array();
- foreach($matches as $match) {
- $this->position += strlen($match[0]);
- $comments[] = $match[1];
- }
- if (!preg_match($commentDeclEndPattern, $this->rawtext, $matches, NULL, $this->position)) {
- break;
- }
- $this->position += strlen($matches[0]);
- $this->emitCharacters();
- if (count($comments) == 1) {
- $this->handler->comment($comments[0]);
- } else {
- $this->handler->comment($comments);
- }
- break;
- }
- if (preg_match($cdataPattern, $this->rawtext, $matches, PREG_OFFSET_CAPTURE, $this->position)) {
- $cdata = $matches[1][0];
- $this->position += strlen($matches[0][0]);
-
- $this->emitCharacters();
-
- $this->handler->cdata($cdata);
- }
-
- break;
-
- default:
- $this->position--; // We overcaptured
- if (!preg_match($startElementPattern, $this->rawtext, $matches, PREG_OFFSET_CAPTURE, $this->position)) {
- break;
- }
- $tag = $matches[1][0];
- $attributes = array();
- $this->position += strlen($matches[0][0]);
-
- if (preg_match_all($attributePattern, $this->rawtext, $matches, PREG_SET_ORDER, $this->position)) {
- foreach($matches as $match) {
- $this->position += strlen($match[0]);
- $name = $match[1];
- if (isset($match[4])) {
- $value = $match[4];
- } else {
- $value = NULL;
- }
- $attributes[$name] = $value;
- }
- }
-
- if (!preg_match($startElementEndPattern, $this->rawtext, $matches, NULL, $this->position)) {
- break;
- }
-
- $this->position += strlen($matches[0]);
-
- $this->emitCharacters();
- if (isset($matches[1])) {
- $this->handler->emptyElement($tag, $attributes);
- } else {
- $this->handler->startElement($tag, $attributes);
- }
-
- // see http://www.w3.org/TR/REC-html40/appendix/notes.html#notes-specifying-data
- // for special handling issues with script and style tags
-
- break;
- }
-
- } while ($this->position < $this->length);
-
- // emit any extra characters left on the end
- if ($this->charStart < $this->length) {
- $this->handler->characters(substr($this->rawtext, $this->charStart));
- }
-
- $this->handler->endDocument();
-
- }
-
-}
-?>
Deleted: trunk/Wact/Html/Sax/parser.test.php
===================================================================
--- trunk/Wact/Html/Sax/parser.test.php 2009-05-23 18:13:10 UTC (rev 957)
+++ trunk/Wact/Html/Sax/parser.test.php 2009-05-23 18:16:38 UTC (rev 958)
@@ -1,754 +0,0 @@
-<?php
-
-/*
-Sources of test case material:
-
-http://www.w3.org/XML/Test/
-http://www.hixie.ch/tests/adhoc/html/parsing/
-http://www.w3.org/MarkUp/SGML/sgml-lex/sgml-lex
-*/
-
-Mock::generate('Wact_Html_Sax_Handler', 'MockWact_Html_Sax_Handler');
-
-abstract class WactSaxTestCase extends Wact_Test_Case {
-
- var $parser;
- var $handler;
-
- function setUp() {
- $this->handler = new MockWact_Html_Sax_Handler($this);
-
- $this->parser = $this->createParser();
-
- $this->parser->setHandler($this->handler);
- }
-
- function tearDown() {
- $this->handler->tally();
- }
-
- abstract function createParser();
-
-}
-
-/**
-*/
-class HtmlContentSaxTestCase extends WactSaxTestCase {
-
- function createParser() {
- return new Wact_Html_Sax_Parser();
- }
-
- function testEmpty() {
- $this->handler->expectNever('characters');
- $this->handler->expectNever('startElement');
- $this->handler->expectNever('endElement');
- $this->parser->parse('');
- }
-
- function testSimpledata() {
- $this->handler->expectOnce('characters', array('content'));
- $this->parser->parse('content');
- }
-
- function testPreservingWhiteSpace() {
- $this->handler->expectOnce('characters', array(" content\t\r\n "));
- $this->parser->parse(" content\t\r\n ");
- }
-
-}
-
-/*
-* These test cases are valid HTML markup
-*/
-class HtmlSaxReaderElementMarkupTestCase extends WactSaxTestCase {
-
- function createParser() {
- return new Wact_Html_Sax_Parser();
- }
-
- function testEmptyElement() {
- $this->handler->expectOnce('startElement', array('tag', array()));
- $this->handler->expectOnce('endElement', array('tag'));
- $this->parser->parse('<tag></tag>');
- }
-
- function testElementWithContent() {
- $this->handler->expectOnce('startElement', array('tag', array()));
- $this->handler->expectOnce('characters', array('content'));
- $this->handler->expectOnce('endElement', array('tag'));
- $this->parser->parse('<tag>content</tag>');
- }
-
- function testStartElementWithPreContent() {
- $this->handler->expectOnce('characters', array('content'));
- $this->handler->expectOnce('startElement', array('br', array()));
- $this->parser->parse('content<br>');
- }
-
- function testStartElementWithPostContent() {
- $this->handler->expectOnce('startElement', array('br', array()));
- $this->handler->expectOnce('characters', array('content'));
- $this->parser->parse('<br>content');
- }
-
- function testMismatchedElements() {
- $this->handler->expectArgumentsAt(0, 'startElement', array('b', array()));
- $this->handler->expectArgumentsAt(1, 'startElement', array('i', array()));
- $this->handler->expectArgumentsAt(0, 'endElement', array('b'));
- $this->handler->expectArgumentsAt(1, 'endElement', array('i'));
- $this->handler->expectCallCount('startElement', 2);
- $this->handler->expectCallCount('endElement', 2);
- $this->handler->expectOnce('characters', array('content'));
- $this->parser->parse('<b><i>content</b></i>');
- }
-
- function testEndElement() {
- $this->handler->expectOnce('endElement', array('tag'));
- $this->handler->expectNever('characters');
- $this->parser->parse('</tag>');
- }
-
- function testEndElementWithPreContent() {
- $this->handler->expectOnce('characters', array('a'));
- $this->handler->expectOnce('endElement', array('tag'));
- $this->parser->parse('a</tag>');
- }
-
- function testEndElementWithPostContent() {
- $this->handler->expectOnce('endElement', array('tag'));
- $this->handler->expectOnce('characters', array('a'));
- $this->parser->parse('</tag>a');
- }
-
- function testEndElementWithSpace() {
- $this->handler->expectOnce('endElement', array('tag'));
- $this->handler->expectNever('characters');
- $this->parser->parse('</tag >');
- }
-
- function testEmptyElementSelfClose() {
- $this->handler->expectOnce('emptyElement', array('br', array()));
- $this->handler->expectNever('startElement');
- $this->handler->expectNever('endElement');
- $this->handler->expectNever('characters');
- $this->parser->parse('<br/>');
- }
-
- function testEmptyElementSelfCloseWithSpace() {
- $this->handler->expectOnce('emptyElement', array('br', array()));
- $this->handler->expectNever('startElement');
- $this->handler->expectNever('endElement');
- $this->handler->expectNever('characters');
- $this->parser->parse('<br />');
- }
-
- function testElementNestedSingleQuote() {
- $this->handler->expectOnce('startElement', array('tag', array('attribute' => '\'')));
- $this->handler->expectNever('characters');
- $this->handler->expectNever('endElement');
- $this->parser->parse('<tag attribute="\'">');
- }
-
- function testElementNestedDoubleQuote() {
- $this->handler->expectOnce('startElement', array('tag', array('attribute' => '"')));
- $this->handler->expectNever('characters');
- $this->handler->expectNever('endElement');
- $this->parser->parse('<tag attribute=\'"\'>');
- }
-
- function testAttributes() {
- $this->handler->expectOnce(
- 'startElement',
- array('tag', array("a" => "A", "b" => "B", "c" => "C")));
- $this->handler->expectNever('characters');
- $this->parser->parse('<tag a="A" b=\'B\' c = "C">');
- }
-
- function testEmptyAttributes() {
- $this->handler->expectOnce(
- 'startElement',
- array('tag', array("a" => NULL, "b" => NULL, "c" => NULL)));
- $this->handler->expectNever('characters');
- $this->parser->parse('<tag a b c>');
- }
-
- function testNastyAttributes() {
- $this->handler->expectOnce(
- 'startElement',
- array('tag', array("a" => "&%$'?<>", "b" => "\r\n\t\"", "c" => "")));
- $this->handler->expectNever('characters');
- $this->parser->parse("<tag a=\"&%$'?<>\" b='\r\n\t\"' c = ''>");
- }
-
- function testAttributesPadding() {
- $this->handler->expectOnce(
- 'startElement',
- array('tag', array("a" => "A", "b" => "B", "c" => "C")));
- $this->handler->expectNever('characters');
- $this->parser->parse("<tag\ta=\"A\"\rb='B'\nc = \"C\"\n>");
- }
-
- function testTruncatedOpen() {
- $this->handler->expectOnce('characters', array('content<'));
- $this->handler->expectNever('startElement');
- $this->parser->parse('content<');
- }
-
- function testTruncatedEmptyClose() {
- $this->handler->expectOnce('characters', array('content</'));
- $this->handler->expectNever('endElement');
- $this->parser->parse('content</');
- }
-
- function testTruncatedClose() {
- $this->handler->expectOnce('characters', array('content</a'));
- $this->parser->parse('content</a');
- $this->handler->expectNever('endElement');
- }
-
- function testTruncatedOpenElementChar() {
- $this->handler->expectOnce('characters', array('content<a'));
- $this->handler->expectNever('startElement');
- $this->parser->parse('content<a');
- }
-
- function testTruncatedOpenElement() {
- $this->handler->expectOnce('characters', array('content<tag'));
- $this->handler->expectNever('startElement');
- $this->parser->parse('content<tag');
- }
-
- function testTruncatedOpenElementSpace() {
- $this->handler->expectOnce('characters', array('content<tag '));
- $this->handler->expectNever('startElement');
- $this->parser->parse('content<tag ');
- }
-
- function testTruncatedOpenElementMinimizedAttribute() {
- $this->handler->expectOnce('characters', array('content<tag attribute'));
- $this->handler->expectNever('startElement');
- $this->parser->parse('content<tag attribute');
- }
-
- function testTruncatedOpenElementMinimizedAttributeSpace() {
- $this->handler->expectOnce('characters', array('content<tag attribute '));
- $this->handler->expectNever('startElement');
- $this->parser->parse('content<tag attribute ');
- }
-
- function testTruncatedOpenElementAttribute() {
- $this->handler->expectOnce('characters', array('content<tag attribute='));
- $this->handler->expectNever('startElement');
- $this->parser->parse('content<tag attribute=');
- }
-
- function testTruncatedOpenElementAttributeSpace() {
- $this->handler->expectOnce('characters', array('content<tag attribute= '));
- $this->handler->expectNever('startElement');
- $this->parser->parse('content<tag attribute= ');
- }
-
- function testTruncatedOpenElementAttributeNoQuote() {
- $this->handler->expectOnce('characters', array('content<tag attribute=value'));
- $this->handler->expectNever('startElement');
- $this->parser->parse('content<tag attribute=value');
- }
-
- function testTruncatedOpenElementAttributeDoubleQuote() {
- $this->handler->expectOnce('characters', array('content<tag attribute="'));
- $this->handler->expectNever('startElement');
- $this->parser->parse('content<tag attribute="');
- }
-
- function testTruncatedOpenElementAttributeDoubleQuoteNoClose() {
- $this->handler->expectOnce('characters', array('content<tag attribute="value'));
- $this->handler->expectNever('startElement');
- $this->parser->parse('content<tag attribute="value');
- }
-
- function testTruncatedOpenElementAttributeDoubleQuoteValue() {
- $this->handler->expectOnce('characters', array('content<tag attribute="value"'));
- $this->handler->expectNever('startElement');
- $this->parser->parse('content<tag attribute="value"');
- }
-
- function testTruncatedOpenElementAttributeSingleQuote() {
- $this->handler->expectOnce('characters', array('content<tag attribute=\''));
- $this->handler->expectNever('startElement');
- $this->parser->parse('content<tag attribute=\'');
- }
-
- function testTruncatedOpenElementAttributeSingleQuoteNoClose() {
- $this->handler->expectOnce('characters', array('content<tag attribute=\'value'));
- $this->handler->expectNever('startElement');
- $this->parser->parse('content<tag attribute=\'value');
- }
-
- function testTruncatedOpenElementAttributeSingleQuoteValue() {
- $this->handler->expectOnce('characters', array('content<tag attribute=\'value\''));
- $this->handler->expectNever('startElement');
- $this->parser->parse('content<tag attribute=\'value\'');
- }
-
- function testTruncatedOpenElementClose() {
- $this->handler->expectOnce('characters', array('content<tag attribute=\'value\'/'));
- $this->handler->expectNever('startElement');
- $this->parser->parse('content<tag attribute=\'value\'/');
- }
-
-}
-
-/*
-* These test cases are valid HTML markup
-*/
-class HtmlSaxReaderProcessingInstructionMarkupTestCase extends WactSaxTestCase {
-
- function createParser() {
- return new Wact_Html_Sax_Parser();
- }
-
- function testTargetOnlyProcessingInstruction() {
- $this->handler->expectOnce('characters', array('<?php ?>'));
- $this->parser->parse('<?php ?>');
- }
-
- function testAllprocessingInstruction() {
- $this->handler->expectOnce('characters', array('<?php print "Hello"; ?>'));
- $this->handler->expectNever('startElement');
- $this->handler->expectNever('endElement');
- $this->parser->parse('<?php print "Hello"; ?>');
- }
-
- function testNestedprocessingInstruction() {
- $this->handler->expectOnce('characters', array('a<?php print "Hello"; ?>b'));
- $this->handler->expectNever('startElement');
- $this->handler->expectNever('endElement');
- $this->parser->parse('a<?php print "Hello"; ?>b');
- }
-
- function testTruncatedProcessingInstruction() {
- $this->handler->expectOnce('characters', array('content<?'));
- $this->handler->expectNever('startElement');
- $this->parser->parse('content<?');
- }
-
- function testMalformedProcessingInstruction() {
- $this->handler->expectOnce('characters', array('content<?>'));
- $this->parser->parse('content<?>');
- }
-
- function testMalformedProcessingInstruction2() {
- $this->handler->expectOnce('characters', array('<??>'));
- $this->parser->parse('<??>');
- }
-
- function testTruncatedProcessingInstructionTarget() {
- $this->handler->expectOnce('characters', array('content<?php'));
- $this->handler->expectNever('startElement');
- $this->parser->parse('content<?php');
- }
-
- function testTruncatedProcessingInstructionNoClose() {
- $this->handler->expectOnce('characters', array('content<?php '));
- $this->handler->expectNever('startElement');
- $this->parser->parse('content<?php ');
- }
-
- function testXmlDecl() {
- $this->parser->parse('<?xml version="1.0"?>');
- }
-
- function testXmlDeclWithEncoding() {
- $this->parser->parse('<?xml version="1.0" encoding="UTF-8" ?>');
- }
-
- function testXmlDeclWithStandalone() {
- $this->parser->parse('<?xml version="1.0" standalone="yes" ?>');
- }
-
- function testXmlDeclWithEncodingAndStandalone() {
- $this->parser->parse('<?xml version="1.0" encoding="UTF-8" standalone="yes"?>');
- }
-
- // Much evil remains to be perpatrated via invalid xml declarations.
-
-}
-
-class HtmlSaxReaderCommentTestCase extends WactSaxTestCase {
-
- function createParser() {
- return new Wact_Html_Sax_Parser();
- }
-
- /*
- * HTML 4.0: Valid Markup
- * XML 1.1: Valid Markup
- */
- function testEmptyComment() {
- $this->handler->expectOnce('comment', array(''));
- $this->handler->expectNever('characters');
- $this->parser->parse('<!---->');
- }
-
- /*
- * HTML 4.0: Valid Markup see http://www.w3.org/MarkUp/SGML/sgml-lex/sgml-lex
- * XML 1.1: Valid Markup
- */
- function testSimpleComment() {
- $this->handler->expectOnce('comment', array(' xyz '));
- $this->parser->parse('<!-- xyz -->');
- }
-
- /*
- * HTML 4.0: Valid Markup
- * XML 1.1: Valid Markup
- */
- function testNastyComment() {
- $this->handler->expectOnce(
- 'comment',
- array(' <tag></tag><?php ?><' . '% %> '));
- $this->handler->expectNever('characters');
- $this->parser->parse('<tag><!-- <tag></tag><?php ?><' . '% %> --></tag>');
- }
-
- /*
- * XML 1.1: Not well-formed see http://www.w3.org/TR/xml11/#sec-comments
- */
- function testNotWellFormedComment() {
- $this->handler->expectOnce('characters', array('<!-- B+, B, or B--->'));
- $this->handler->expectNever('comment');
- $this->parser->parse('<!-- B+, B, or B--->');
- }
-
- /*
- * HTML 4.0: Valid Markup see http://www.w3.org/MarkUp/SGML/sgml-lex/sgml-lex
- * XML 1.1: Not well-formed see http://www.w3.org/TR/xml11/#sec-comments
- */
- function testCompoundComment() {
- $this->handler->expectOnce('comment', array(array(' xyz ', 'def')));
- $this->parser->parse('<!-- xyz -- --def-->');
- }
-
- /*
- * HTML 4.0: Valid Markup see http://www.w3.org/MarkUp/SGML/sgml-lex/sgml-lex
- * XML 1.1: Not well-formed see http://www.w3.org/TR/xml11/#sec-comments
- */
- function testCompoundComment2() {
- $this->handler->expectOnce('comment', array(array('', '', '')));
- $this->parser->parse('<!---- ---- ---->');
- }
-
- /*
- * HTML 4.0: Valid Markup see http://www.w3.org/MarkUp/SGML/sgml-lex/sgml-lex
- * XML 1.1: Not well-formed see http://www.w3.org/TR/xml11/#sec-comments
- */
- function testCompoundComment3() {
- $this->handler->expectOnce('comment', array(array('', '', '')));
- $this->parser->parse('<!------------>');
- }
-
- /*
- * HTML 4.0: Invalid Markup see http://www.w3.org/MarkUp/SGML/sgml-lex/sgml-lex
- * XML 1.1: Not well-formed see http://www.w3.org/TR/xml11/#sec-comments
- */
- function testMalformedComment() {
- $this->handler->expectOnce('characters', array('<!--x->'));
- $this->handler->expectNever('comment');
- $this->parser->parse('<!--x->');
- }
-
- /*
- * HTML 4.0: Invalid Markup see http://www.w3.org/MarkUp/SGML/sgml-lex/sgml-lex
- * XML 1.1: Not well-formed see http://www.w3.org/TR/xml11/#sec-comments
- */
- function testMalformedComment2() {
- $this->handler->expectOnce('characters', array('<!-- comment-- xxx>'));
- $this->handler->expectNever('comment');
- $this->parser->parse('<!-- comment-- xxx>');
- }
-
- /*
- * HTML 4.0: Invalid Markup see http://www.w3.org/MarkUp/SGML/sgml-lex/sgml-lex
- * XML 1.1: Not well-formed see http://www.w3.org/TR/xml11/#sec-comments
- */
- function testMalformedComment3() {
- $this->handler->expectOnce('characters', array('<!-- comment -- ->'));
- $this->handler->expectNever('comment');
- $this->parser->parse('<!-- comment -- ->');
- }
-
- /*
- * HTML 4.0: Invalid Markup see http://www.w3.org/MarkUp/SGML/sgml-lex/sgml-lex
- * XML 1.1: Not well-formed see http://www.w3.org/TR/xml11/#sec-comments
- */
- function testMalformedComment4() {
- $this->handler->expectOnce('characters', array('<!----->'));
- $this->handler->expectNever('comment');
- $this->parser->parse('<!----->');
- }
-
- /*
- * HTML 4.0: Valid markup
- * XML 1.1: Not well-formed see http://www.w3.org/TR/xml11/#sec-comments
- *
- * see http://www.hixie.ch/tests/adhoc/html/parsing/compat/008.html
- */
- function testCommentedTag() {
- $this->handler->expectOnce('comment', array('><span><!'));
- $this->handler->expectNever('startElement');
- $this->parser->parse('<!--><span><!-->');
- }
-
- /*
- * HTML 4.0: Valid markup
- * XML 1.1: Not well-formed see http://www.w3.org/TR/xml11/#sec-comments
- *
- * see http://www.hixie.ch/tests/adhoc/html/parsing/comments/001.html
- */
- function testNextedCommentConfusion() {
- $this->handler->expectArgumentsAt(0, 'comment', array(array('', '><!')));
- $this->handler->expectArgumentsAt(1, 'comment', array(array('', '-><!')));
- $this->handler->expectCallCount('comment', 2);
- $this->handler->expectOnce('characters', array('PASS'));
- $this->handler->expectNever('startElement');
- $this->parser->parse('<!------><!-->PASS<!-------><!-->');
- }
-
- /*
- * HTML 4.0: Invalid Markup
- * XML 1.1: Not well-formed
- *
- * see http://www.hixie.ch/tests/adhoc/html/parsing/comments/002.html
- */
- function testMalformedComment5() {
- $this->handler->expectOnce('characters', array('<!-- --FAIL>'));
- $this->handler->expectNever('comment');
- $this->parser->parse('<!-- --FAIL>');
- }
-
- /*
- * HTML 4.0: Invalid Markup
- * XML 1.1: Not well-formed
- *
- * see http://www.hixie.ch/tests/adhoc/html/parsing/comments/003.html
- */
- function testMalformedComment6() {
- $this->handler->expectOnce('characters', array('<!-- --- FAIL --- -->'));
- $this->handler->expectNever('comment');
- $this->parser->parse('<!-- --- FAIL --- -->');
- }
-
- /*
- * HTML 4.0: Valid Markup
- * XML 1.1: Not well-formed
- *
- * see http://www.hixie.ch/tests/evil/mixed/comments-evil.html
- */
- function testCompoundComment7() {
- $this->handler->expectOnce('comment', array(' ->incorrect<!- '));
- $this->handler->expectNever('characters');
- $this->parser->parse('<!-- ->incorrect<!- -->');
- }
-
- /*
- * HTML 4.0: Valid Markup
- * XML 1.1: Not well-formed
- *
- * see http://www.hixie.ch/tests/evil/mixed/comments-evil.html
- */
- function testCompoundComment8() {
- $this->handler->expectOnce('comment', array(array(' ', '>incorrect<!', '')));
- $this->handler->expectNever('characters');
- $this->parser->parse('<!-- ---->incorrect<!------>');
- }
-
- /*
- * HTML 4.0: Valid Markup
- * XML 1.1: Not well-formed
- *
- * see http://www.hixie.ch/tests/evil/mixed/comments-evil.html
- */
- function testCompoundComment9() {
- $this->handler->expectOnce('comment', array(array('', '>incorrect<!', '')));
- $this->handler->expectNever('characters');
- $this->parser->parse('<!------>incorrect<!------>');
- }
-
- /*
- * HTML 4.0: Valid Markup
- * XML 1.1: Not well-formed
- *
- * see http://www.hixie.ch/tests/evil/mixed/comments-evil.html
- */
- function testCompoundComment10() {
- $this->handler->expectOnce('comment', array(array('', '>incorrect<!', '')));
- $this->handler->expectNever('characters');
- $this->parser->parse('<!---- -->incorrect<!------>');
- }
-
- /*
- * HTML 4.0: Valid Markup
- * XML 1.1: Not well-formed
- *
- * see http://www.hixie.ch/tests/evil/mixed/comments-evil.html
- */
- function testCompoundComment11() {
- $this->handler->expectOnce('comment', array(array(' ', '>incorrect<!', ' ')));
- $this->handler->expectNever('characters');
- $this->parser->parse('<!-- -- -->incorrect<!-- -- -->');
- }
-
- /*
- */
- function testTruncatedComment() {
- $this->handler->expectOnce('characters', array('content<!--'));
- $this->handler->expectNever('comment');
- $this->parser->parse('content<!--');
- }
-
- /*
- */
- function testTruncatedCommentNoClose() {
- $this->handler->expectOnce('characters', array('content<!-- blah'));
- $this->handler->expectNever('comment');
- $this->parser->parse('content<!-- blah');
- }
-
-}
-
-class HtmlSaxReaderCdataTestCase extends WactSaxTestCase {
-
- function createParser() {
- return new Wact_Html_Sax_Parser();
- }
-
- function testCData() {
- $this->handler->expectOnce(
- 'cdata',
- array('string = \'A CDATA block\';'));
- $this->parser->parse('<![CDATA[string = \'A CDATA block\';]]>');
- }
-
- function testCData2() {
- $this->handler->expectOnce(
- 'cdata',
- array('<tag>'));
- $this->parser->parse('<![CDATA[<tag>]]>');
- }
-
- function testCDataPrePost() {
- $this->handler->expectArgumentsAt(0, 'characters', array('abc'));
- $this->handler->expectArgumentsAt(1, 'cdata', array('string = \'A CDATA block\';'));
- $this->handler->expectArgumentsAt(2, 'characters', array('def'));
-
- $this->parser->parse('abc<![CDATA[string = \'A CDATA block\';]]>def');
- }
-
-}
-
-/*
-* These cases are valid HTML Markup syntax, but they do not generate markup events
-* in our SaxReader implementation
-*
-* SGML Short tag syntax
-*
-* Empty start-tag :
-* <UL>
-* <LI> this is the first item of the list
-* <> this is second one -- implied identifier is LI
-* </>
-*
-* Empty end-tag:
-* Some <B>bold text with empty end tag </> -- right here.
-*
-* Unclosed tags :
-* This text is <b<i> bold and italic at once </b</i>.
-*
-* Null-end tags :
-* <H1/Header with null-end tag/
-*
-*/
-class HtmlSaxReaderValidHtmlMarkupTestCase extends WactSaxTestCase {
-
- function createParser() {
- return new Wact_Html_Sax_Parser();
- }
-
- function testEmptyClose() {
- $this->handler->expectOnce('characters', array('</>'));
- $this->handler->expectNever('endElement');
- $this->parser->parse('</>');
- }
-
-}
-
-/*
-* malformed Markup
-*/
-class HtmlSaxReaderMalformedTestCase extends WactSaxTestCase {
-
- function createParser() {
- return new Wact_Html_Sax_Parser();
- }
-
- function testOpenElementMalformedClose() {
- $this->handler->expectOnce('characters', array('content<tag attribute=\'value\'/morecontent'));
- $this->handler->expectNever('startElement');
- $this->parser->parse('content<tag attribute=\'value\'/morecontent');
- }
-
- function testOpenElementMalformedClose2() {
- $this->handler->expectOnce('startElement', array('tag', array('attribute' => '\'value\'/morecontent')));
- $this->handler->expectOnce('characters', array('content'));
- $this->parser->parse('content<tag attribute=\'value\'/morecontent>');
- }
-
- function testElementNestedSingleQuote() {
- $this->handler->expectOnce('startElement', array('tag', array('attribute' => '\'')));
- $this->handler->expectNever('characters');
- $this->handler->expectNever('endElement');
- $this->parser->parse('<tag attribute=\'\'\'>');
- }
-
- function testElementNestedDoubleQuote() {
- $this->handler->expectOnce('startElement', array('tag', array('attribute' => '"')));
- $this->handler->expectNever('characters');
- $this->handler->expectNever('endElement');
- $this->parser->parse('<tag attribute=""">');
- }
-
- function testElementMalformedAttribute() {
- $this->handler->expectOnce('startElement', array('tag', array('attribute' => '"test"extra')));
- $this->handler->expectNever('characters');
- $this->handler->expectNever('endElement');
- $this->parser->parse('<tag attribute="test"extra>');
- }
-
- function testNotAnEndElementWithSpace() {
- $this->handler->expectOnce('characters', array('< /tag>'));
- $this->parser->parse('< /tag>');
- }
-
-}
-
- /*
- removed due to bug #1000806
- see http://www.w3.org/TR/REC-html40/appendix/notes.html#notes-specifying-data
- function testScriptElement() {
- $this->handler->expectOnce('startElement', array('script', array('language'=>'Javascript')));
- $this->handler->expectOnce('endElement', array('script'));
- $this->handler->expectOnce('characters', array("document.write('<B>Test<\/B>');"));
- $this->parser->parse('<script language="Javascript">document.write(\'<B>Test<\/B>\');</script>');
- }
-
- function testScriptElementEmbedComment() {
- $this->handler->expectOnce('startElement', array('script', array('language'=>'Javascript')));
- $this->handler->expectOnce('endElement', array('script'));
- $this->handler->expectOnce('characters', array("<!-- document.write('<B>Test<\/B>'); -->"));
- $this->parser->parse('<script language="Javascript"><!-- document.write(\'<B>Test<\/B>\'); --></script>');
- }
- */
-
-
-?>
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <Jef...@us...> - 2009-05-23 18:13:16
|
Revision: 957
http://wact.svn.sourceforge.net/wact/?rev=957&view=rev
Author: JeffMoore
Date: 2009-05-23 18:13:10 +0000 (Sat, 23 May 2009)
Log Message:
-----------
Removing result of cp instead of mv
Removed Paths:
-------------
trunk/Wact/Error/Formatter/base.inc.php
trunk/Wact/Error/Formatter/html.inc.php
Deleted: trunk/Wact/Error/Formatter/base.inc.php
===================================================================
--- trunk/Wact/Error/Formatter/base.inc.php 2009-05-23 18:11:56 UTC (rev 956)
+++ trunk/Wact/Error/Formatter/base.inc.php 2009-05-23 18:13:10 UTC (rev 957)
@@ -1,29 +0,0 @@
-<?php
-/**
-* Web Application Component Toolkit
-*
-* @link http://www.phpwact.org/
-*
-* @author Wact Development Team
-* @link http://www.phpwact.org/team
-*
-* @copyright Copyright 2006, Jeff Moore
-* @license http://opensource.org/licenses/mit-license.php MIT
-*/
-
-/**
-* Base class for message formatters
-*/
-class Wact_Error_Formatter_Base {
-
- protected $message = '';
-
- /**
- */
- function getMessage() {
- return $this->message;
- }
-
-}
-
-?>
\ No newline at end of file
Deleted: trunk/Wact/Error/Formatter/html.inc.php
===================================================================
--- trunk/Wact/Error/Formatter/html.inc.php 2009-05-23 18:11:56 UTC (rev 956)
+++ trunk/Wact/Error/Formatter/html.inc.php 2009-05-23 18:13:10 UTC (rev 957)
@@ -1,47 +0,0 @@
-<?php
-/**
-* Web Application Component Toolkit
-*
-* @link http://www.phpwact.org/
-*
-* @author Wact Development Team
-* @link http://www.phpwact.org/team
-*
-* @copyright Copyright 2006, Jeff Moore
-* @license http://opensource.org/licenses/mit-license.php MIT
-*/
-
-/**
-* Turn a console oriented exception message into an HTML message.
-*/
-class Wact_Error_Formatter_Html extends Wact_Error_Formatter_Html_StackTrace implements Wact_Error_Formatter {
-
- /**
- */
- function beginError() {
- $this->message .= "<table style='color:black;background-color:white' border='1' cellspacing='0'>\n";
- }
-
- /**
- */
- function endError() {
- $this->message .= "</table>";
- }
-
- /**
- */
- function writeErrorMessage($message, $file, $line, $level) {
- $this->message .= "<tr>\n";
- $this->message .= "<td bgcolor='#ff9999'>\n";
- $this->message .= '<b>' . $level . '</b>: ';
- $this->message .= '<i>' . htmlspecialchars($message) . '</i>';
- $this->message .= ' in <b>' . $file . '</b> on line <b>' . $line . "</b>\n";
- $this->message .= "<br />\n";
-
- $this->message .= "</td>\n";
- $this->message .= "</tr>\n";
- }
-
-}
-
-?>
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|