argil-svn Mailing List for Argil Framework (Page 2)
Status: Alpha
Brought to you by:
tswicegood
You can subscribe to this list here.
| 2007 |
Jan
|
Feb
(18) |
Mar
(8) |
Apr
(11) |
May
(23) |
Jun
(1) |
Jul
(6) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|---|
|
From: <tsw...@us...> - 2007-05-24 01:50:39
|
Revision: 523
http://argil.svn.sourceforge.net/argil/?rev=523&view=rev
Author: tswicegood
Date: 2007-05-23 18:50:40 -0700 (Wed, 23 May 2007)
Log Message:
-----------
Add in test to fix issue with annotations that have no parameters and
refactor loading of specs so everything can be loaded.
Modified Paths:
--------------
branches/experimental/src/Argil/Reflection/Property.php
branches/experimental/tests/Argil/Reflection/PropertyTest.php
Modified: branches/experimental/src/Argil/Reflection/Property.php
===================================================================
--- branches/experimental/src/Argil/Reflection/Property.php 2007-05-24 01:39:14 UTC (rev 522)
+++ branches/experimental/src/Argil/Reflection/Property.php 2007-05-24 01:50:40 UTC (rev 523)
@@ -1,5 +1,5 @@
<?php
-require_once 'Argil/Specification/Length.php';
+
class Argil_Reflection_Property
{
private $_decorated = null;
@@ -14,15 +14,21 @@
$method
) , $arguments);
}
+
+ /**
+ * @todo refactor out specification loading into Argil_Loader_Specification
+ */
public function isValid($object)
{
$doc = $this->getDocComment();
$name = $this->getName();
$value = $object->$name;
- if (preg_match_all('/@(is|isNot) ([a-z]+) (.*)/', $doc, $matches)) {
+ if (preg_match_all('/@(is|isNot) ([a-z]+) ?(.*)/i', $doc, $matches)) {
foreach($matches[2] as $key => $spec) {
$spec = ucfirst($spec);
- $reflection = new ReflectionClass('Argil_Specification_' . $spec);
+ $specName = 'Argil_Specification_' . $spec;
+ require_once str_replace('_', '/', $specName) . '.php';
+ $reflection = new ReflectionClass($specName);
$args = array_merge(array(
$value
) , explode(' ', $matches[3][$key]));
@@ -42,6 +48,7 @@
}
}
}
+
return true;
}
}
Modified: branches/experimental/tests/Argil/Reflection/PropertyTest.php
===================================================================
--- branches/experimental/tests/Argil/Reflection/PropertyTest.php 2007-05-24 01:39:14 UTC (rev 522)
+++ branches/experimental/tests/Argil/Reflection/PropertyTest.php 2007-05-24 01:50:40 UTC (rev 523)
@@ -14,6 +14,11 @@
* @isNot length 5 <
*/
public $notLessThanFive;
+
+ /**
+ * @is String
+ */
+ public $string = '';
}
class Argil_Reflection_PropertyTest extends UnitTestCase
{
@@ -53,4 +58,18 @@
$object->notLessThanFive = '12345';
$this->assertTrue($attribute->isValid($object));
}
+
+ public function testAllowsSpecsWithoutParameters()
+ {
+ $object = new ArgilSamplePropertyObjectForReflection();
+ $reflection = new ReflectionObject($object);
+
+ $properties = $reflection->getProperties();
+ $stringReflection = new Argil_Reflection_Property($properties[4]);
+
+ $this->assertEqual('string', $stringReflection->getName(), 'sanity check');
+ $object->string = 123;
+ $this->assertFalse($stringReflection->isValid($object));
+
+ }
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tsw...@us...> - 2007-05-24 01:40:27
|
Revision: 522
http://argil.svn.sourceforge.net/argil/?rev=522&view=rev
Author: tswicegood
Date: 2007-05-23 18:39:14 -0700 (Wed, 23 May 2007)
Log Message:
-----------
Add a String spec object that's tested
Added Paths:
-----------
branches/experimental/src/Argil/Specification/String.php
branches/experimental/tests/Argil/Specification/StringTest.php
Added: branches/experimental/src/Argil/Specification/String.php
===================================================================
--- branches/experimental/src/Argil/Specification/String.php (rev 0)
+++ branches/experimental/src/Argil/Specification/String.php 2007-05-24 01:39:14 UTC (rev 522)
@@ -0,0 +1,19 @@
+<?php
+
+class Argil_Specification_String
+{
+ private $_valid = false;
+
+ public function __construct($string)
+ {
+ if (is_string($string) || (is_object($string) && method_exists($string, '__toString'))) {
+ $this->_valid = true;
+ }
+
+ }
+
+ public function valid()
+ {
+ return $this->_valid;
+ }
+}
\ No newline at end of file
Added: branches/experimental/tests/Argil/Specification/StringTest.php
===================================================================
--- branches/experimental/tests/Argil/Specification/StringTest.php (rev 0)
+++ branches/experimental/tests/Argil/Specification/StringTest.php 2007-05-24 01:39:14 UTC (rev 522)
@@ -0,0 +1,41 @@
+<?php
+
+require_once dirname(__FILE__) . '/../../config.php';
+require_once 'Argil/Specification/String.php';
+
+
+class ArgilSpecificationStringableObject
+{
+ public function __toString() { }
+}
+
+class Argil_Specification_StringTest extends UnitTestCase
+{
+ public function testValidatesStrings()
+ {
+ $spec = new Argil_Specification_String('Hello World');
+ $this->assertTrue($spec->valid());
+
+ $spec = new Argil_Specification_String($this);
+ $this->assertFalse($spec->valid());
+
+ $spec = new Argil_Specification_String(123);
+ $this->assertFalse($spec->valid());
+
+ $spec = new Argil_Specification_String(123.321);
+ $this->assertFalse($spec->valid());
+
+ $spec = new Argil_Specification_String(false);
+ $this->assertFalse($spec->valid());
+
+ $spec = new Argil_Specification_String(array());
+ $this->assertFalse($spec->valid());
+ }
+
+ public function testAllowsObjectsThatHaveAToStringMagicMethod()
+ {
+ $string = new ArgilSpecificationStringableObject();
+ $spec = new Argil_Specification_String($string);
+ $this->assertTrue($spec->valid());
+ }
+}
\ 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: <tsw...@us...> - 2007-05-13 19:08:51
|
Revision: 521
http://argil.svn.sourceforge.net/argil/?rev=521&view=rev
Author: tswicegood
Date: 2007-05-13 12:08:52 -0700 (Sun, 13 May 2007)
Log Message:
-----------
Get rid of the project file
Removed Paths:
-------------
branches/experimental/Argil.kpf
Deleted: branches/experimental/Argil.kpf
===================================================================
--- branches/experimental/Argil.kpf 2007-05-13 05:53:10 UTC (rev 520)
+++ branches/experimental/Argil.kpf 2007-05-13 19:08:52 UTC (rev 521)
@@ -1,61 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Komodo Project File - DO NOT EDIT -->
-<project kpf_version="3" id="3e236782-8105-402b-b29b-41c882a9c592" name="Argil.kpf">
-<preference-set idref="3e236782-8105-402b-b29b-41c882a9c592/tests/AllTest.php">
- <string id="lastInvocation">default</string>
-<preference-set id="Invocations">
-<preference-set id="default">
- <string id="cwd"></string>
- <string id="postparams"></string>
- <string id="language">PHP</string>
- <string id="getparams"></string>
- <string id="phpInterpreterType">php-cli</string>
- <boolean id="use-console">0</boolean>
- <string relative="path" id="filename">tests/AllTest.php</string>
- <string id="mpostparams"></string>
- <boolean id="show-dialog">1</boolean>
- <string id="request-method">GET</string>
- <string id="params"></string>
- <string id="executable-params"></string>
- <string id="posttype">application/x-www-form-urlencoded</string>
- <string id="documentRoot"></string>
- <string id="cookieparams"></string>
- <boolean id="enableImplicitFlush">1</boolean>
- <string id="userEnvironment"></string>
- <boolean id="sim-cgi">0</boolean>
- <boolean id="disableOutputBuffering">1</boolean>
- <string id="userCGIEnvironment"></string>
-</preference-set>
-</preference-set>
-</preference-set>
-<preference-set idref="3e236782-8105-402b-b29b-41c882a9c592/tests/config.php">
- <string id="lastInvocation">default</string>
-<preference-set id="Invocations">
-<preference-set id="default">
- <string id="cwd"></string>
- <string id="postparams"></string>
- <string id="language">PHP</string>
- <string id="getparams"></string>
- <string id="phpInterpreterType">php-cli</string>
- <boolean id="use-console">0</boolean>
- <string relative="path" id="filename">tests/config.php</string>
- <string id="mpostparams"></string>
- <boolean id="show-dialog">1</boolean>
- <string id="request-method">GET</string>
- <string id="params"></string>
- <string id="executable-params"></string>
- <string id="posttype">application/x-www-form-urlencoded</string>
- <string id="documentRoot"></string>
- <string id="cookieparams"></string>
- <boolean id="enableImplicitFlush">1</boolean>
- <string id="userEnvironment"></string>
- <boolean id="sim-cgi">0</boolean>
- <boolean id="disableOutputBuffering">1</boolean>
- <string id="userCGIEnvironment"></string>
-</preference-set>
-</preference-set>
-</preference-set>
-<preference-set idref="3e236782-8105-402b-b29b-41c882a9c592">
- <boolean id="import_live">1</boolean>
-</preference-set>
-</project>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tsw...@us...> - 2007-05-13 05:53:10
|
Revision: 520
http://argil.svn.sourceforge.net/argil/?rev=520&view=rev
Author: tswicegood
Date: 2007-05-12 22:53:10 -0700 (Sat, 12 May 2007)
Log Message:
-----------
Move src/ code over to PEAR formatting standards. Done via php_beautifier.
Modified Paths:
--------------
branches/experimental/src/Argil/Model/Container.php
branches/experimental/src/Argil/Reflection/Object.php
branches/experimental/src/Argil/Reflection/Property.php
branches/experimental/src/Argil/Reflection/PropertyList.php
branches/experimental/src/Argil/Route.php
branches/experimental/src/Argil/Specification/Length.php
Modified: branches/experimental/src/Argil/Model/Container.php
===================================================================
--- branches/experimental/src/Argil/Model/Container.php 2007-05-13 05:52:03 UTC (rev 519)
+++ branches/experimental/src/Argil/Model/Container.php 2007-05-13 05:53:10 UTC (rev 520)
@@ -1,51 +1,47 @@
<?php
-
require_once 'Argil/Reflection/Object.php';
-
class Argil_Model_Container
{
- private $_contained = array();
- private $_reflections = array();
-
- public function __construct() {
- if (func_num_args() > 0) {
- foreach (func_get_args() as $object) {
- $this->_contained[get_class($object)] = $object;
- $this->_reflections[get_class($object)] = new Argil_Reflection_Object($object);
- }
- }
- }
-
- public function is($name) {
- return isset($this->_contained[$name]);
- }
-
- public function __set($key, $value) {
- foreach ($this->_contained as $objectName => $object) {
- $vars = get_object_vars($object);
- if (!isset($vars[$key])) {
- continue;
- }
-
- $property = $this->_reflections[$objectName]->getProperty($key);
- $oldValue = $object->$key;
- $object->$key = $value;
- if (!$property->isValid($object)) {
- $object->$key = $oldValue;
- throw new Exception();
- }
- return;
- }
-
- throw new Exception();
- }
-
- public function __get($key) {
- foreach ($this->_contained as $object) {
- $vars = get_object_vars($object);
- if (isset($vars[$key])) {
- return $object->$key;
- }
- }
- }
+ private $_contained = array();
+ private $_reflections = array();
+ public function __construct()
+ {
+ if (func_num_args() > 0) {
+ foreach(func_get_args() as $object) {
+ $this->_contained[get_class($object) ] = $object;
+ $this->_reflections[get_class($object) ] = new Argil_Reflection_Object($object);
+ }
+ }
+ }
+ public function is($name)
+ {
+ return isset($this->_contained[$name]);
+ }
+ public function __set($key, $value)
+ {
+ foreach($this->_contained as $objectName => $object) {
+ $vars = get_object_vars($object);
+ if (!isset($vars[$key])) {
+ continue;
+ }
+ $property = $this->_reflections[$objectName]->getProperty($key);
+ $oldValue = $object->$key;
+ $object->$key = $value;
+ if (!$property->isValid($object)) {
+ $object->$key = $oldValue;
+ throw new Exception();
+ }
+ return;
+ }
+ throw new Exception();
+ }
+ public function __get($key)
+ {
+ foreach($this->_contained as $object) {
+ $vars = get_object_vars($object);
+ if (isset($vars[$key])) {
+ return $object->$key;
+ }
+ }
+ }
}
Modified: branches/experimental/src/Argil/Reflection/Object.php
===================================================================
--- branches/experimental/src/Argil/Reflection/Object.php 2007-05-13 05:52:03 UTC (rev 519)
+++ branches/experimental/src/Argil/Reflection/Object.php 2007-05-13 05:53:10 UTC (rev 520)
@@ -1,33 +1,27 @@
<?php
-
require_once 'Argil/Reflection/Property.php';
require_once 'Argil/Reflection/PropertyList.php';
-
class Argil_Reflection_Object
{
- private $_decorated = null;
-
- public function __construct($object) {
- assert('is_object($object)');
- $this->_decorated = new ReflectionObject($object);
- }
-
- public function __call($method, $arguments) {
- return call_user_func_array(
- array($this->_decorated, $method),
- $arguments
- );
- }
-
- public function getProperties() {
- return new Argil_Reflection_PropertyList(
- $this->_decorated->getProperties()
- );
- }
-
- public function getProperty($name) {
- return new Argil_Reflection_Property(
- $this->_decorated->getProperty($name)
- );
- }
-}
\ No newline at end of file
+ private $_decorated = null;
+ public function __construct($object)
+ {
+ assert('is_object($object)');
+ $this->_decorated = new ReflectionObject($object);
+ }
+ public function __call($method, $arguments)
+ {
+ return call_user_func_array(array(
+ $this->_decorated,
+ $method
+ ) , $arguments);
+ }
+ public function getProperties()
+ {
+ return new Argil_Reflection_PropertyList($this->_decorated->getProperties());
+ }
+ public function getProperty($name)
+ {
+ return new Argil_Reflection_Property($this->_decorated->getProperty($name));
+ }
+}
Modified: branches/experimental/src/Argil/Reflection/Property.php
===================================================================
--- branches/experimental/src/Argil/Reflection/Property.php 2007-05-13 05:52:03 UTC (rev 519)
+++ branches/experimental/src/Argil/Reflection/Property.php 2007-05-13 05:53:10 UTC (rev 520)
@@ -1,50 +1,47 @@
<?php
-
require_once 'Argil/Specification/Length.php';
-
-class Argil_Reflection_Property
+class Argil_Reflection_Property
{
- private $_decorated = null;
-
- public function __construct(ReflectionProperty $property) {
- $this->_decorated = $property;
- }
-
- public function __call($method, $arguments) {
- return call_user_func_array(
- array($this->_decorated, $method),
- $arguments
- );
- }
-
- public function isValid($object) {
- $doc = $this->getDocComment();
- $name = $this->getName();
- $value = $object->$name;
- if (preg_match_all('/@(is|isNot) ([a-z]+) (.*)/', $doc, $matches)) {
- foreach ($matches[2] as $key => $spec) {
- $spec = ucfirst($spec);
- $reflection = new ReflectionClass('Argil_Specification_' . $spec);
- $args = array_merge(
- array($value),
- explode(' ', $matches[3][$key])
- );
- $specObj = $reflection->newInstanceArgs($args);
- switch ($matches[1][$key]) {
- case 'is' :
- if (!$specObj->valid()) {
- return false;
- }
- break;
- case 'isNot' :
- if ($specObj->valid()) {
- return false;
- }
- break;
- }
- }
- }
-
- return true;
- }
+ private $_decorated = null;
+ public function __construct(ReflectionProperty $property)
+ {
+ $this->_decorated = $property;
+ }
+ public function __call($method, $arguments)
+ {
+ return call_user_func_array(array(
+ $this->_decorated,
+ $method
+ ) , $arguments);
+ }
+ public function isValid($object)
+ {
+ $doc = $this->getDocComment();
+ $name = $this->getName();
+ $value = $object->$name;
+ if (preg_match_all('/@(is|isNot) ([a-z]+) (.*)/', $doc, $matches)) {
+ foreach($matches[2] as $key => $spec) {
+ $spec = ucfirst($spec);
+ $reflection = new ReflectionClass('Argil_Specification_' . $spec);
+ $args = array_merge(array(
+ $value
+ ) , explode(' ', $matches[3][$key]));
+ $specObj = $reflection->newInstanceArgs($args);
+ switch ($matches[1][$key]) {
+ case 'is':
+ if (!$specObj->valid()) {
+ return false;
+ }
+ break;
+
+ case 'isNot':
+ if ($specObj->valid()) {
+ return false;
+ }
+ break;
+ }
+ }
+ }
+ return true;
+ }
}
Modified: branches/experimental/src/Argil/Reflection/PropertyList.php
===================================================================
--- branches/experimental/src/Argil/Reflection/PropertyList.php 2007-05-13 05:52:03 UTC (rev 519)
+++ branches/experimental/src/Argil/Reflection/PropertyList.php 2007-05-13 05:53:10 UTC (rev 520)
@@ -1,40 +1,48 @@
<?php
-
require_once 'Argil/Reflection/Property.php';
-
-class Argil_Reflection_PropertyList
- implements ArrayAccess, Countable, SeekableIterator
+class Argil_Reflection_PropertyList implements ArrayAccess, Countable, SeekableIterator
{
- private $_data = array();
-
- public function __construct(array $propertyList) {
- $this->_data = $propertyList;
- }
-
- public function offsetExists($offset) {
- return isset($this->_data[$offset]);
- }
-
- public function offsetGet($offset) {
- return new Argil_Reflection_Property($this->_data[$offset]);
- }
-
- public function offsetSet($offset, $value) {
- throw new Exception();
- }
-
- public function offsetUnset($offset) {
- throw new Exception();
- }
-
- public function count() {
- return count($this->_data);
- }
-
- public function seek($index) { }
- public function current() { }
- public function key() { }
- public function next() { }
- public function rewind() { }
- public function valid() { }
-}
\ No newline at end of file
+ private $_data = array();
+ public function __construct(array$propertyList)
+ {
+ $this->_data = $propertyList;
+ }
+ public function offsetExists($offset)
+ {
+ return isset($this->_data[$offset]);
+ }
+ public function offsetGet($offset)
+ {
+ return new Argil_Reflection_Property($this->_data[$offset]);
+ }
+ public function offsetSet($offset, $value)
+ {
+ throw new Exception();
+ }
+ public function offsetUnset($offset)
+ {
+ throw new Exception();
+ }
+ public function count()
+ {
+ return count($this->_data);
+ }
+ public function seek($index)
+ {
+ }
+ public function current()
+ {
+ }
+ public function key()
+ {
+ }
+ public function next()
+ {
+ }
+ public function rewind()
+ {
+ }
+ public function valid()
+ {
+ }
+}
Modified: branches/experimental/src/Argil/Route.php
===================================================================
--- branches/experimental/src/Argil/Route.php 2007-05-13 05:52:03 UTC (rev 519)
+++ branches/experimental/src/Argil/Route.php 2007-05-13 05:53:10 UTC (rev 520)
@@ -1,14 +1,13 @@
<?php
-
class Argil_Route
{
- private $_callback = null;
-
- public function __construct($callback) {
- $this->_callback = $callback;
- }
-
- public function execute() {
- call_user_func($this->_callback);
- }
+ private $_callback = null;
+ public function __construct($callback)
+ {
+ $this->_callback = $callback;
+ }
+ public function execute()
+ {
+ call_user_func($this->_callback);
+ }
}
Modified: branches/experimental/src/Argil/Specification/Length.php
===================================================================
--- branches/experimental/src/Argil/Specification/Length.php 2007-05-13 05:52:03 UTC (rev 519)
+++ branches/experimental/src/Argil/Specification/Length.php 2007-05-13 05:53:10 UTC (rev 520)
@@ -1,36 +1,31 @@
<?php
-
class Argil_Specification_Length
{
- private
- $_comparison,
- $_length,
- $_value;
-
- public function __construct($value, $length, $comparison = '==') {
- $this->_value = $value;
- $this->_length = $length;
- $this->_comparison = $comparison;
- }
-
- public function valid() {
- $actualLength = strlen($this->_value);
- switch ($this->_comparison) {
- case '==' :
- return $actualLength == $this->_length;
- case '<=' :
- return $actualLength <= $this->_length;
- case '>=' :
- return $actualLength >= $this->_length;
- case '>' :
- return $actualLength > $this->_length;
- case '<' :
- return $actualLength < $this->_length;
- case '<>' :
- case '!=' :
- return $actualLength != $this->_length;
- }
-
- throw new Exception();
- }
-}
\ No newline at end of file
+ private $_comparison, $_length, $_value;
+ public function __construct($value, $length, $comparison = '==')
+ {
+ $this->_value = $value;
+ $this->_length = $length;
+ $this->_comparison = $comparison;
+ }
+ public function valid()
+ {
+ $actualLength = strlen($this->_value);
+ switch ($this->_comparison) {
+ case '==':
+ return $actualLength == $this->_length;
+ case '<=':
+ return $actualLength <= $this->_length;
+ case '>=':
+ return $actualLength >= $this->_length;
+ case '>':
+ return $actualLength > $this->_length;
+ case '<':
+ return $actualLength < $this->_length;
+ case '<>':
+ case '!=':
+ return $actualLength != $this->_length;
+ }
+ throw new Exception();
+ }
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tsw...@us...> - 2007-05-13 05:52:03
|
Revision: 519
http://argil.svn.sourceforge.net/argil/?rev=519&view=rev
Author: tswicegood
Date: 2007-05-12 22:52:03 -0700 (Sat, 12 May 2007)
Log Message:
-----------
Move all tests over to PEAR formatting standards
Modified Paths:
--------------
branches/experimental/tests/AllTest.php
branches/experimental/tests/Argil/Model/ContainerTest.php
branches/experimental/tests/Argil/Reflection/ObjectTest.php
branches/experimental/tests/Argil/Reflection/PropertyListTest.php
branches/experimental/tests/Argil/Reflection/PropertyTest.php
branches/experimental/tests/Argil/RouteTest.php
branches/experimental/tests/Argil/Specification/LengthTest.php
branches/experimental/tests/config.php
Modified: branches/experimental/tests/AllTest.php
===================================================================
--- branches/experimental/tests/AllTest.php 2007-04-05 03:27:38 UTC (rev 518)
+++ branches/experimental/tests/AllTest.php 2007-05-13 05:52:03 UTC (rev 519)
@@ -1,15 +1,14 @@
<?php
-
require_once dirname(__FILE__) . '/config.php';
-
class ArgilTestSuite extends TestSuite
{
- public function __construct() {
- $this->addTestFile('Argil/Model/ContainerTest.php');
- $this->addTestFile('Argil/Reflection/ObjectTest.php');
- $this->addTestFile('Argil/Reflection/PropertyListTest.php');
- $this->addTestFile('Argil/Reflection/PropertyTest.php');
- $this->addTestFile('Argil/RouteTest.php');
- $this->addTestFile('Argil/Specification/LengthTest.php');
- }
+ public function __construct()
+ {
+ $this->addTestFile('Argil/Model/ContainerTest.php');
+ $this->addTestFile('Argil/Reflection/ObjectTest.php');
+ $this->addTestFile('Argil/Reflection/PropertyListTest.php');
+ $this->addTestFile('Argil/Reflection/PropertyTest.php');
+ $this->addTestFile('Argil/RouteTest.php');
+ $this->addTestFile('Argil/Specification/LengthTest.php');
+ }
}
Modified: branches/experimental/tests/Argil/Model/ContainerTest.php
===================================================================
--- branches/experimental/tests/Argil/Model/ContainerTest.php 2007-04-05 03:27:38 UTC (rev 518)
+++ branches/experimental/tests/Argil/Model/ContainerTest.php 2007-05-13 05:52:03 UTC (rev 519)
@@ -1,94 +1,76 @@
<?php
-
require_once dirname(__FILE__) . '/../../config.php';
require_once 'Argil/Model/Container.php';
-
-class ArgilSampleModel {
- /**
- * @is length 5 >
- */
- public $title = '';
-
- /**
- * @is length 10
- */
- public $lengthOfTen = '';
+class ArgilSampleModel
+{
+ /**
+ * @is length 5 >
+ */
+ public $title = '';
+ /**
+ * @is length 10
+ */
+ public $lengthOfTen = '';
}
-class ArgilSampleModelTwo { }
-
+class ArgilSampleModelTwo
+{
+}
class Argil_Model_ContainerTest extends UnitTestCase
{
- public function testWillTellWhatTypeOfObjectThisContains() {
- $container = new Argil_Model_Container(
- new ArgilSampleModel()
- );
-
- $this->assertTrue($container->is('ArgilSampleModel'));
- $this->assertFalse($container->is(__CLASS__));
- }
-
- public function testCanContainMultipleObjects() {
- $container = new Argil_Model_Container(
- new ArgilSampleModel(),
- new ArgilSampleModelTwo()
- );
-
- $this->assertFalse($container->is(__CLASS__));
- $this->assertTrue($container->is('ArgilSampleModel'));
- $this->assertTrue($container->is('ArgilSampleModelTwo'));
- }
-
- public function testWillOnlyAllowSettingOfKnownProperties() {
- $container = new Argil_Model_Container(
- new ArgilSampleModel()
- );
-
- $container->title = 'Hello World';
- $this->assertEqual($container->title, 'Hello World');
-
- try {
- $container->unknown = 'Throw Exception';
- $this->fail('Exception not caught');
- } catch (Exception $e) {
-
- }
- }
-
- public function testProperlyValidatesUsingAnnotation() {
- $container = new Argil_Model_Container(
- new ArgilSampleModel()
- );
-
- try {
- $container->lengthOfTen = '1234567890';
- $this->pass('Exception not expected');
- } catch(Exception $e) {
- $this->fail('Unexpected exception?');
- }
-
- try {
- $container->lengthOfTen = '123456789';
- $this->fail('Exception not caught');
- } catch(Exception $e) {
- $this->pass('Exception caught');
- }
- }
-
- public function testOriginalValueKeptWhenInvalidPropertySet() {
- $container = new Argil_Model_Container(
- new ArgilSampleModel()
- );
-
- $container->lengthOfTen = '1234567890';
-
- try {
- $container->lengthOfTen = '123456789';
- $this->fail('Exception not caught');
- } catch(Exception $e) {
- $this->pass('Exception caught');
- }
-
- $this->assertEqual($container->lengthOfTen, '1234567890');
- }
+ public function testWillTellWhatTypeOfObjectThisContains()
+ {
+ $container = new Argil_Model_Container(new ArgilSampleModel());
+ $this->assertTrue($container->is('ArgilSampleModel'));
+ $this->assertFalse($container->is(__CLASS__));
+ }
+ public function testCanContainMultipleObjects()
+ {
+ $container = new Argil_Model_Container(new ArgilSampleModel() , new ArgilSampleModelTwo());
+ $this->assertFalse($container->is(__CLASS__));
+ $this->assertTrue($container->is('ArgilSampleModel'));
+ $this->assertTrue($container->is('ArgilSampleModelTwo'));
+ }
+ public function testWillOnlyAllowSettingOfKnownProperties()
+ {
+ $container = new Argil_Model_Container(new ArgilSampleModel());
+ $container->title = 'Hello World';
+ $this->assertEqual($container->title, 'Hello World');
+ try {
+ $container->unknown = 'Throw Exception';
+ $this->fail('Exception not caught');
+ }
+ catch(Exception $e) {
+ }
+ }
+ public function testProperlyValidatesUsingAnnotation()
+ {
+ $container = new Argil_Model_Container(new ArgilSampleModel());
+ try {
+ $container->lengthOfTen = '1234567890';
+ $this->pass('Exception not expected');
+ }
+ catch(Exception $e) {
+ $this->fail('Unexpected exception?');
+ }
+ try {
+ $container->lengthOfTen = '123456789';
+ $this->fail('Exception not caught');
+ }
+ catch(Exception $e) {
+ $this->pass('Exception caught');
+ }
+ }
+ public function testOriginalValueKeptWhenInvalidPropertySet()
+ {
+ $container = new Argil_Model_Container(new ArgilSampleModel());
+ $container->lengthOfTen = '1234567890';
+ try {
+ $container->lengthOfTen = '123456789';
+ $this->fail('Exception not caught');
+ }
+ catch(Exception $e) {
+ $this->pass('Exception caught');
+ }
+ $this->assertEqual($container->lengthOfTen, '1234567890');
+ }
}
-
Modified: branches/experimental/tests/Argil/Reflection/ObjectTest.php
===================================================================
--- branches/experimental/tests/Argil/Reflection/ObjectTest.php 2007-04-05 03:27:38 UTC (rev 518)
+++ branches/experimental/tests/Argil/Reflection/ObjectTest.php 2007-05-13 05:52:03 UTC (rev 519)
@@ -1,34 +1,26 @@
<?php
-
require_once dirname(__FILE__) . '/../../config.php';
require_once 'Argil/Reflection/Object.php';
-
-class ArgilSampleReflectionObject {
- public $publicProperty = '';
- protected $protectedProperty = '';
- private $privateProperty = '';
+class ArgilSampleReflectionObject
+{
+ public $publicProperty = '';
+ protected $protectedProperty = '';
+ private $privateProperty = '';
}
-
class Argil_Reflection_ObjectTest extends UnitTestCase
{
- public function testReturnsArrayOfProperties() {
- $reflection = new Argil_Reflection_Object(
- new ArgilSampleReflectionObject()
- );
- $properties = $reflection->getProperties();
-
- $this->assertTrue(is_array($properties) || $properties instanceof ArrayAccess);
- $this->assertTrue(count($properties) == 3);
-
- $this->assertIsA($properties[0], 'Argil_Reflection_Property');
- }
-
- public function testReturnsANamedProperty() {
- $reflection = new Argil_Reflection_Object(
- new ArgilSampleReflectionObject()
- );
-
- $property = $reflection->getProperty('publicProperty');
- $this->assertIsA($property, 'Argil_Reflection_Property');
- }
-}
\ No newline at end of file
+ public function testReturnsArrayOfProperties()
+ {
+ $reflection = new Argil_Reflection_Object(new ArgilSampleReflectionObject());
+ $properties = $reflection->getProperties();
+ $this->assertTrue(is_array($properties) || $properties instanceof ArrayAccess);
+ $this->assertTrue(count($properties) == 3);
+ $this->assertIsA($properties[0], 'Argil_Reflection_Property');
+ }
+ public function testReturnsANamedProperty()
+ {
+ $reflection = new Argil_Reflection_Object(new ArgilSampleReflectionObject());
+ $property = $reflection->getProperty('publicProperty');
+ $this->assertIsA($property, 'Argil_Reflection_Property');
+ }
+}
Modified: branches/experimental/tests/Argil/Reflection/PropertyListTest.php
===================================================================
--- branches/experimental/tests/Argil/Reflection/PropertyListTest.php 2007-04-05 03:27:38 UTC (rev 518)
+++ branches/experimental/tests/Argil/Reflection/PropertyListTest.php 2007-05-13 05:52:03 UTC (rev 519)
@@ -1,83 +1,63 @@
<?php
-
require_once dirname(__FILE__) . '/../../config.php';
require_once 'Argil/Reflection/PropertyList.php';
-
-class ArgilSampleReflectionObjectForProperties {
- public $publicProperty = '';
- protected $protectedProperty = '';
- private $privateProperty = '';
+class ArgilSampleReflectionObjectForProperties
+{
+ public $publicProperty = '';
+ protected $protectedProperty = '';
+ private $privateProperty = '';
}
-
-class Argil_Reflection_PropertyListTest extends UnitTestCase {
- public function testActsAsArray() {
- $reflection = new ReflectionObject(
- new ArgilSampleReflectionObjectForProperties()
- );
-
- $properties = new Argil_Reflection_PropertyList(
- $reflection->getProperties()
- );
-
- $this->assertIsA($properties, 'Countable');
- $this->assertIsA($properties, 'ArrayAccess');
- $this->assertIsA($properties, 'SeekableIterator');
-
- // sanity check for Countable
- $this->assertEqual(3, count($properties));
-
- // sanity check for ArrayAccess
- $this->assertTrue(isset($properties[0]));
- $this->assertNotNull($properties[0]);
- }
-
- public function testArrayIsReadOnly() {
- $reflection = new ReflectionObject(
- new ArgilSampleReflectionObjectForProperties()
- );
-
- $properties = new Argil_Reflection_PropertyList(
- $reflection->getProperties()
- );
-
- try {
- $properties['unknown'] = "Shouldn't work";
- $this->fail('Exception not caught');
- } catch (Exception $e) {
- $this->pass('Exception caught');
- }
-
- try {
- $this->assertTrue(isset($properties[0]));
- $properties[0] = "Shouldn't work";
- $this->fail('Exception not caught');
- } catch (Exception $e) {
- $this->pass('Exception caught');
- }
-
- try {
- $this->assertTrue(isset($properties[0]));
- unset($properties[0]);
- $this->fail('Exception not caught');
- } catch (Exception $e) {
- $this->pass('Exception caught');
- $this->assertTrue(isset($properties[0]));
- }
- }
-
- public function testMapsAllValuesToArgilWrapper() {
- $reflection = new ReflectionObject(
- new ArgilSampleReflectionObjectForProperties()
- );
-
- $properties = new Argil_Reflection_PropertyList(
- $reflection->getProperties()
- );
-
- // sanity check
- $this->assertTrue(isset($properties[0]));
- $this->assertIsA($properties[0], 'Argil_Reflection_Property');
-
- $this->assertEqual('publicProperty', $properties[0]->getName());
- }
-}
\ No newline at end of file
+class Argil_Reflection_PropertyListTest extends UnitTestCase
+{
+ public function testActsAsArray()
+ {
+ $reflection = new ReflectionObject(new ArgilSampleReflectionObjectForProperties());
+ $properties = new Argil_Reflection_PropertyList($reflection->getProperties());
+ $this->assertIsA($properties, 'Countable');
+ $this->assertIsA($properties, 'ArrayAccess');
+ $this->assertIsA($properties, 'SeekableIterator');
+ // sanity check for Countable
+ $this->assertEqual(3, count($properties));
+ // sanity check for ArrayAccess
+ $this->assertTrue(isset($properties[0]));
+ $this->assertNotNull($properties[0]);
+ }
+ public function testArrayIsReadOnly()
+ {
+ $reflection = new ReflectionObject(new ArgilSampleReflectionObjectForProperties());
+ $properties = new Argil_Reflection_PropertyList($reflection->getProperties());
+ try {
+ $properties['unknown'] = "Shouldn't work";
+ $this->fail('Exception not caught');
+ }
+ catch(Exception $e) {
+ $this->pass('Exception caught');
+ }
+ try {
+ $this->assertTrue(isset($properties[0]));
+ $properties[0] = "Shouldn't work";
+ $this->fail('Exception not caught');
+ }
+ catch(Exception $e) {
+ $this->pass('Exception caught');
+ }
+ try {
+ $this->assertTrue(isset($properties[0]));
+ unset($properties[0]);
+ $this->fail('Exception not caught');
+ }
+ catch(Exception $e) {
+ $this->pass('Exception caught');
+ $this->assertTrue(isset($properties[0]));
+ }
+ }
+ public function testMapsAllValuesToArgilWrapper()
+ {
+ $reflection = new ReflectionObject(new ArgilSampleReflectionObjectForProperties());
+ $properties = new Argil_Reflection_PropertyList($reflection->getProperties());
+ // sanity check
+ $this->assertTrue(isset($properties[0]));
+ $this->assertIsA($properties[0], 'Argil_Reflection_Property');
+ $this->assertEqual('publicProperty', $properties[0]->getName());
+ }
+}
Modified: branches/experimental/tests/Argil/Reflection/PropertyTest.php
===================================================================
--- branches/experimental/tests/Argil/Reflection/PropertyTest.php 2007-04-05 03:27:38 UTC (rev 518)
+++ branches/experimental/tests/Argil/Reflection/PropertyTest.php 2007-05-13 05:52:03 UTC (rev 519)
@@ -1,72 +1,56 @@
<?php
-
require_once dirname(__FILE__) . '/../../config.php';
require_once 'Argil/Reflection/Property.php';
-
-class ArgilSamplePropertyObjectForReflection {
- /**
- * @is length 10 <=
- * @is length 5 >=
- */
- public $publicProperty;
- protected $protectedProperty;
- private $privateProperty;
-
- /**
- * @isNot length 5 <
- */
- public $notLessThanFive;
+class ArgilSamplePropertyObjectForReflection
+{
+ /**
+ * @is length 10 <=
+ * @is length 5 >=
+ */
+ public $publicProperty;
+ protected $protectedProperty;
+ private $privateProperty;
+ /**
+ * @isNot length 5 <
+ */
+ public $notLessThanFive;
}
-
-class Argil_Reflection_PropertyTest extends UnitTestCase {
- public function testWrapsReflectionPropertyObject() {
- $reflection = new ReflectionObject(
- new ArgilSamplePropertyObjectForReflection()
- );
-
- $properties = $reflection->getProperties();
-
- $public = new Argil_Reflection_Property($properties[0]);
- $this->assertTrue($public->isPublic());
- $this->assertFalse($public->isProtected());
- $this->assertFalse($public->isPrivate());
- $this->assertEqual($public->getName(), 'publicProperty');
-
- $protected = new Argil_Reflection_Property($properties[1]);
- $this->assertTrue($protected->isProtected());
- $this->assertFalse($protected->isPublic());
- $this->assertFalse($protected->isPrivate());
-
- $private = new Argil_Reflection_Property($properties[2]);
- $this->assertTrue($private->isPrivate());
- $this->assertFalse($private->isPublic());
- $this->assertFalse($private->isProtected());
- }
-
- public function testUsesDocBlockToDetermineValidity() {
- $reflection = new ReflectionObject(
- new ArgilSamplePropertyObjectForReflection()
- );
-
- $properties = $reflection->getProperties();
-
- $public = new Argil_Reflection_Property($properties[0]);
-
- $object = new ArgilSamplePropertyObjectForReflection();
- $object->publicProperty = '1234567890';
- $this->assertTrue($public->isValid($object));
-
- $object->publicProperty = '12345678901';
- $this->assertFalse($public->isValid($object));
-
- $object->publicProperty = '1234';
- $this->assertFalse($public->isValid($object));
-
- $object->notLessThanFive = '1234';
- $attribute = new Argil_Reflection_Property($properties[3]);
- $this->assertFalse($attribute->isValid($object));
-
- $object->notLessThanFive = '12345';
- $this->assertTrue($attribute->isValid($object));
- }
-}
\ No newline at end of file
+class Argil_Reflection_PropertyTest extends UnitTestCase
+{
+ public function testWrapsReflectionPropertyObject()
+ {
+ $reflection = new ReflectionObject(new ArgilSamplePropertyObjectForReflection());
+ $properties = $reflection->getProperties();
+ $public = new Argil_Reflection_Property($properties[0]);
+ $this->assertTrue($public->isPublic());
+ $this->assertFalse($public->isProtected());
+ $this->assertFalse($public->isPrivate());
+ $this->assertEqual($public->getName() , 'publicProperty');
+ $protected = new Argil_Reflection_Property($properties[1]);
+ $this->assertTrue($protected->isProtected());
+ $this->assertFalse($protected->isPublic());
+ $this->assertFalse($protected->isPrivate());
+ $private = new Argil_Reflection_Property($properties[2]);
+ $this->assertTrue($private->isPrivate());
+ $this->assertFalse($private->isPublic());
+ $this->assertFalse($private->isProtected());
+ }
+ public function testUsesDocBlockToDetermineValidity()
+ {
+ $reflection = new ReflectionObject(new ArgilSamplePropertyObjectForReflection());
+ $properties = $reflection->getProperties();
+ $public = new Argil_Reflection_Property($properties[0]);
+ $object = new ArgilSamplePropertyObjectForReflection();
+ $object->publicProperty = '1234567890';
+ $this->assertTrue($public->isValid($object));
+ $object->publicProperty = '12345678901';
+ $this->assertFalse($public->isValid($object));
+ $object->publicProperty = '1234';
+ $this->assertFalse($public->isValid($object));
+ $object->notLessThanFive = '1234';
+ $attribute = new Argil_Reflection_Property($properties[3]);
+ $this->assertFalse($attribute->isValid($object));
+ $object->notLessThanFive = '12345';
+ $this->assertTrue($attribute->isValid($object));
+ }
+}
Modified: branches/experimental/tests/Argil/RouteTest.php
===================================================================
--- branches/experimental/tests/Argil/RouteTest.php 2007-04-05 03:27:38 UTC (rev 518)
+++ branches/experimental/tests/Argil/RouteTest.php 2007-05-13 05:52:03 UTC (rev 519)
@@ -1,29 +1,23 @@
<?php
-
require_once dirname(__FILE__) . '/../config.php';
require_once 'Argil/Route.php';
-
-class ArgilCallbackObject {
- public function callback() { }
+class ArgilCallbackObject
+{
+ public function callback()
+ {
+ }
}
-
Mock::generate('ArgilCallbackObject');
-
class Argil_RouteTest extends UnitTestCase
{
- public function testBasicCallback() {
- $mock = new MockArgilCallbackObject();
- $mock->expectOnce('callback');
-
- $route = new Argil_Route(
- array(
- $mock,
- 'callback'
- )
- );
-
- $route->execute();
- }
+ public function testBasicCallback()
+ {
+ $mock = new MockArgilCallbackObject();
+ $mock->expectOnce('callback');
+ $route = new Argil_Route(array(
+ $mock,
+ 'callback'
+ ));
+ $route->execute();
+ }
}
-
-
Modified: branches/experimental/tests/Argil/Specification/LengthTest.php
===================================================================
--- branches/experimental/tests/Argil/Specification/LengthTest.php 2007-04-05 03:27:38 UTC (rev 518)
+++ branches/experimental/tests/Argil/Specification/LengthTest.php 2007-05-13 05:52:03 UTC (rev 519)
@@ -1,77 +1,67 @@
<?php
-
require_once dirname(__FILE__) . '/../../config.php';
require_once 'Argil/Specification/Length.php';
-
class Argil_Specification_LengthTest extends UnitTestCase
{
- public function testAllowsLengthEquals() {
- $spec = new Argil_Specification_Length('12345', 5);
- $this->assertTrue($spec->valid());
-
- $spec = new Argil_Specification_Length('123456', 5);
- $this->assertFalse($spec->valid());
- }
-
- public function testAllowsLengthLesserThanOrEquals() {
- $spec = new Argil_Specification_Length('12345', 5, '<=');
- $this->assertTrue($spec->valid());
-
- $spec = new Argil_Specification_Length('1234', 5, '<=');
- $this->assertTrue($spec->valid());
-
- $spec = new Argil_Specification_Length('123456', 5, '<=');
- $this->assertFalse($spec->valid());
- }
-
- public function testAllowsLengthGreaterThanOrEquals() {
- $spec = new Argil_Specification_Length('12345', 4, '>=');
- $this->assertTrue($spec->valid());
-
- $spec = new Argil_Specification_Length('1234', 4, '>=');
- $this->assertTrue($spec->valid());
-
- $spec = new Argil_Specification_Length('123', 4, '>=');
- $this->assertFalse($spec->valid());
- }
-
- public function testAllowsLengthGreaterThan() {
- $spec = new Argil_Specification_Length('12345', 4, '>');
- $this->assertTrue($spec->valid());
-
- $spec = new Argil_Specification_Length('1234', 4, '>');
- $this->assertFalse($spec->valid());
- }
-
- public function testAllowsLengthLesserThan() {
- $spec = new Argil_Specification_Length('12345', 6, '<');
- $this->assertTrue($spec->valid());
-
- $spec = new Argil_Specification_Length('123456', 6, '<');
- $this->assertFalse($spec->valid());
- }
-
- public function testAllowsBothNotEquals() {
- $spec = new Argil_Specification_Length('123456', 5, '<>');
- $this->assertTrue($spec->valid());
-
- $spec = new Argil_Specification_Length('123456', 5, '!=');
- $this->assertTrue($spec->valid());
-
- $spec = new Argil_Specification_Length('12345', 5, '<>');
- $this->assertFalse($spec->valid());
-
- $spec = new Argil_Specification_Length('12345', 5, '!=');
- $this->assertFalse($spec->valid());
- }
-
- public function testThrowsExceptionOnUnknownComparisonType() {
- $spec = new Argil_Specification_Length('12345', 5, 'unknown');
- try {
- $spec->valid();
- $this->fail('Exception not caught');
- } catch (Exception $e) {
- $this->pass('Exception caught');
- }
- }
-}
\ No newline at end of file
+ public function testAllowsLengthEquals()
+ {
+ $spec = new Argil_Specification_Length('12345', 5);
+ $this->assertTrue($spec->valid());
+ $spec = new Argil_Specification_Length('123456', 5);
+ $this->assertFalse($spec->valid());
+ }
+ public function testAllowsLengthLesserThanOrEquals()
+ {
+ $spec = new Argil_Specification_Length('12345', 5, '<=');
+ $this->assertTrue($spec->valid());
+ $spec = new Argil_Specification_Length('1234', 5, '<=');
+ $this->assertTrue($spec->valid());
+ $spec = new Argil_Specification_Length('123456', 5, '<=');
+ $this->assertFalse($spec->valid());
+ }
+ public function testAllowsLengthGreaterThanOrEquals()
+ {
+ $spec = new Argil_Specification_Length('12345', 4, '>=');
+ $this->assertTrue($spec->valid());
+ $spec = new Argil_Specification_Length('1234', 4, '>=');
+ $this->assertTrue($spec->valid());
+ $spec = new Argil_Specification_Length('123', 4, '>=');
+ $this->assertFalse($spec->valid());
+ }
+ public function testAllowsLengthGreaterThan()
+ {
+ $spec = new Argil_Specification_Length('12345', 4, '>');
+ $this->assertTrue($spec->valid());
+ $spec = new Argil_Specification_Length('1234', 4, '>');
+ $this->assertFalse($spec->valid());
+ }
+ public function testAllowsLengthLesserThan()
+ {
+ $spec = new Argil_Specification_Length('12345', 6, '<');
+ $this->assertTrue($spec->valid());
+ $spec = new Argil_Specification_Length('123456', 6, '<');
+ $this->assertFalse($spec->valid());
+ }
+ public function testAllowsBothNotEquals()
+ {
+ $spec = new Argil_Specification_Length('123456', 5, '<>');
+ $this->assertTrue($spec->valid());
+ $spec = new Argil_Specification_Length('123456', 5, '!=');
+ $this->assertTrue($spec->valid());
+ $spec = new Argil_Specification_Length('12345', 5, '<>');
+ $this->assertFalse($spec->valid());
+ $spec = new Argil_Specification_Length('12345', 5, '!=');
+ $this->assertFalse($spec->valid());
+ }
+ public function testThrowsExceptionOnUnknownComparisonType()
+ {
+ $spec = new Argil_Specification_Length('12345', 5, 'unknown');
+ try {
+ $spec->valid();
+ $this->fail('Exception not caught');
+ }
+ catch(Exception $e) {
+ $this->pass('Exception caught');
+ }
+ }
+}
Modified: branches/experimental/tests/config.php
===================================================================
--- branches/experimental/tests/config.php 2007-04-05 03:27:38 UTC (rev 518)
+++ branches/experimental/tests/config.php 2007-05-13 05:52:03 UTC (rev 519)
@@ -1,11 +1,5 @@
<?php
-
require_once 'simpletest/unit_tester.php';
require_once 'simpletest/mock_objects.php';
require_once 'simpletest/autorun.php';
-
-set_include_path(
- dirname(__FILE__) . PATH_SEPARATOR .
- dirname(__FILE__) . '/../src' . PATH_SEPARATOR .
- get_include_path()
-);
+set_include_path(dirname(__FILE__) . PATH_SEPARATOR . dirname(__FILE__) . '/../src' . PATH_SEPARATOR . get_include_path());
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tsw...@us...> - 2007-04-05 03:27:37
|
Revision: 518
http://argil.svn.sourceforge.net/argil/?rev=518&view=rev
Author: tswicegood
Date: 2007-04-04 20:27:38 -0700 (Wed, 04 Apr 2007)
Log Message:
-----------
Add Specification_Length test to the test suite
Modified Paths:
--------------
branches/experimental/tests/AllTest.php
Modified: branches/experimental/tests/AllTest.php
===================================================================
--- branches/experimental/tests/AllTest.php 2007-04-05 03:21:25 UTC (rev 517)
+++ branches/experimental/tests/AllTest.php 2007-04-05 03:27:38 UTC (rev 518)
@@ -10,5 +10,6 @@
$this->addTestFile('Argil/Reflection/PropertyListTest.php');
$this->addTestFile('Argil/Reflection/PropertyTest.php');
$this->addTestFile('Argil/RouteTest.php');
+ $this->addTestFile('Argil/Specification/LengthTest.php');
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tsw...@us...> - 2007-04-05 03:21:23
|
Revision: 517
http://argil.svn.sourceforge.net/argil/?rev=517&view=rev
Author: tswicegood
Date: 2007-04-04 20:21:25 -0700 (Wed, 04 Apr 2007)
Log Message:
-----------
Add in first pass at doing validation checking at the Container
Modified Paths:
--------------
branches/experimental/src/Argil/Model/Container.php
branches/experimental/tests/Argil/Model/ContainerTest.php
Modified: branches/experimental/src/Argil/Model/Container.php
===================================================================
--- branches/experimental/src/Argil/Model/Container.php 2007-04-05 03:14:15 UTC (rev 516)
+++ branches/experimental/src/Argil/Model/Container.php 2007-04-05 03:21:25 UTC (rev 517)
@@ -1,13 +1,17 @@
<?php
+require_once 'Argil/Reflection/Object.php';
+
class Argil_Model_Container
{
private $_contained = array();
+ private $_reflections = array();
public function __construct() {
if (func_num_args() > 0) {
foreach (func_get_args() as $object) {
$this->_contained[get_class($object)] = $object;
+ $this->_reflections[get_class($object)] = new Argil_Reflection_Object($object);
}
}
}
@@ -17,12 +21,19 @@
}
public function __set($key, $value) {
- foreach ($this->_contained as $object) {
+ foreach ($this->_contained as $objectName => $object) {
$vars = get_object_vars($object);
if (!isset($vars[$key])) {
continue;
}
+
+ $property = $this->_reflections[$objectName]->getProperty($key);
+ $oldValue = $object->$key;
$object->$key = $value;
+ if (!$property->isValid($object)) {
+ $object->$key = $oldValue;
+ throw new Exception();
+ }
return;
}
Modified: branches/experimental/tests/Argil/Model/ContainerTest.php
===================================================================
--- branches/experimental/tests/Argil/Model/ContainerTest.php 2007-04-05 03:14:15 UTC (rev 516)
+++ branches/experimental/tests/Argil/Model/ContainerTest.php 2007-04-05 03:21:25 UTC (rev 517)
@@ -4,7 +4,15 @@
require_once 'Argil/Model/Container.php';
class ArgilSampleModel {
+ /**
+ * @is length 5 >
+ */
public $title = '';
+
+ /**
+ * @is length 10
+ */
+ public $lengthOfTen = '';
}
class ArgilSampleModelTwo { }
@@ -45,5 +53,42 @@
}
}
+
+ public function testProperlyValidatesUsingAnnotation() {
+ $container = new Argil_Model_Container(
+ new ArgilSampleModel()
+ );
+
+ try {
+ $container->lengthOfTen = '1234567890';
+ $this->pass('Exception not expected');
+ } catch(Exception $e) {
+ $this->fail('Unexpected exception?');
+ }
+
+ try {
+ $container->lengthOfTen = '123456789';
+ $this->fail('Exception not caught');
+ } catch(Exception $e) {
+ $this->pass('Exception caught');
+ }
+ }
+
+ public function testOriginalValueKeptWhenInvalidPropertySet() {
+ $container = new Argil_Model_Container(
+ new ArgilSampleModel()
+ );
+
+ $container->lengthOfTen = '1234567890';
+
+ try {
+ $container->lengthOfTen = '123456789';
+ $this->fail('Exception not caught');
+ } catch(Exception $e) {
+ $this->pass('Exception caught');
+ }
+
+ $this->assertEqual($container->lengthOfTen, '1234567890');
+ }
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tsw...@us...> - 2007-04-05 03:14:14
|
Revision: 516
http://argil.svn.sourceforge.net/argil/?rev=516&view=rev
Author: tswicegood
Date: 2007-04-04 20:14:15 -0700 (Wed, 04 Apr 2007)
Log Message:
-----------
Add getProperty() method
Modified Paths:
--------------
branches/experimental/src/Argil/Reflection/Object.php
branches/experimental/tests/Argil/Reflection/ObjectTest.php
Modified: branches/experimental/src/Argil/Reflection/Object.php
===================================================================
--- branches/experimental/src/Argil/Reflection/Object.php 2007-04-01 18:40:08 UTC (rev 515)
+++ branches/experimental/src/Argil/Reflection/Object.php 2007-04-05 03:14:15 UTC (rev 516)
@@ -1,5 +1,6 @@
<?php
+require_once 'Argil/Reflection/Property.php';
require_once 'Argil/Reflection/PropertyList.php';
class Argil_Reflection_Object
@@ -23,4 +24,10 @@
$this->_decorated->getProperties()
);
}
+
+ public function getProperty($name) {
+ return new Argil_Reflection_Property(
+ $this->_decorated->getProperty($name)
+ );
+ }
}
\ No newline at end of file
Modified: branches/experimental/tests/Argil/Reflection/ObjectTest.php
===================================================================
--- branches/experimental/tests/Argil/Reflection/ObjectTest.php 2007-04-01 18:40:08 UTC (rev 515)
+++ branches/experimental/tests/Argil/Reflection/ObjectTest.php 2007-04-05 03:14:15 UTC (rev 516)
@@ -22,4 +22,13 @@
$this->assertIsA($properties[0], 'Argil_Reflection_Property');
}
+
+ public function testReturnsANamedProperty() {
+ $reflection = new Argil_Reflection_Object(
+ new ArgilSampleReflectionObject()
+ );
+
+ $property = $reflection->getProperty('publicProperty');
+ $this->assertIsA($property, 'Argil_Reflection_Property');
+ }
}
\ 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: <tsw...@us...> - 2007-04-01 18:40:07
|
Revision: 515
http://argil.svn.sourceforge.net/argil/?rev=515&view=rev
Author: tswicegood
Date: 2007-04-01 11:40:08 -0700 (Sun, 01 Apr 2007)
Log Message:
-----------
Add in support for @isNot
Modified Paths:
--------------
branches/experimental/src/Argil/Reflection/Property.php
branches/experimental/tests/Argil/Reflection/PropertyTest.php
Modified: branches/experimental/src/Argil/Reflection/Property.php
===================================================================
--- branches/experimental/src/Argil/Reflection/Property.php 2007-04-01 04:51:45 UTC (rev 514)
+++ branches/experimental/src/Argil/Reflection/Property.php 2007-04-01 18:40:08 UTC (rev 515)
@@ -21,17 +21,26 @@
$doc = $this->getDocComment();
$name = $this->getName();
$value = $object->$name;
- if (preg_match_all('/@is ([a-z]+) (.*)/', $doc, $matches)) {
- foreach ($matches[1] as $key => $spec) {
+ if (preg_match_all('/@(is|isNot) ([a-z]+) (.*)/', $doc, $matches)) {
+ foreach ($matches[2] as $key => $spec) {
$spec = ucfirst($spec);
$reflection = new ReflectionClass('Argil_Specification_' . $spec);
$args = array_merge(
array($value),
- explode(' ', $matches[2][$key])
+ explode(' ', $matches[3][$key])
);
$specObj = $reflection->newInstanceArgs($args);
- if (!$specObj->valid()) {
- return false;
+ switch ($matches[1][$key]) {
+ case 'is' :
+ if (!$specObj->valid()) {
+ return false;
+ }
+ break;
+ case 'isNot' :
+ if ($specObj->valid()) {
+ return false;
+ }
+ break;
}
}
}
Modified: branches/experimental/tests/Argil/Reflection/PropertyTest.php
===================================================================
--- branches/experimental/tests/Argil/Reflection/PropertyTest.php 2007-04-01 04:51:45 UTC (rev 514)
+++ branches/experimental/tests/Argil/Reflection/PropertyTest.php 2007-04-01 18:40:08 UTC (rev 515)
@@ -11,6 +11,11 @@
public $publicProperty;
protected $protectedProperty;
private $privateProperty;
+
+ /**
+ * @isNot length 5 <
+ */
+ public $notLessThanFive;
}
class Argil_Reflection_PropertyTest extends UnitTestCase {
@@ -56,5 +61,12 @@
$object->publicProperty = '1234';
$this->assertFalse($public->isValid($object));
+
+ $object->notLessThanFive = '1234';
+ $attribute = new Argil_Reflection_Property($properties[3]);
+ $this->assertFalse($attribute->isValid($object));
+
+ $object->notLessThanFive = '12345';
+ $this->assertTrue($attribute->isValid($object));
}
}
\ 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: <tsw...@us...> - 2007-04-01 04:51:44
|
Revision: 514
http://argil.svn.sourceforge.net/argil/?rev=514&view=rev
Author: tswicegood
Date: 2007-03-31 21:51:45 -0700 (Sat, 31 Mar 2007)
Log Message:
-----------
Start using specification.
This still needs some work. A Specification Locator needs to be implemented so
multiple specs can be used and allow a flex point for scanning multiple places for
Specs, but this starts the code in the right direction.
Modified Paths:
--------------
branches/experimental/src/Argil/Reflection/Property.php
branches/experimental/tests/Argil/Reflection/PropertyTest.php
Modified: branches/experimental/src/Argil/Reflection/Property.php
===================================================================
--- branches/experimental/src/Argil/Reflection/Property.php 2007-04-01 04:38:34 UTC (rev 513)
+++ branches/experimental/src/Argil/Reflection/Property.php 2007-04-01 04:51:45 UTC (rev 514)
@@ -1,5 +1,7 @@
<?php
+require_once 'Argil/Specification/Length.php';
+
class Argil_Reflection_Property
{
private $_decorated = null;
@@ -16,8 +18,24 @@
}
public function isValid($object) {
+ $doc = $this->getDocComment();
$name = $this->getName();
- $len = strlen($object->$name);
- return $len <= 10 && $len >= 5;
+ $value = $object->$name;
+ if (preg_match_all('/@is ([a-z]+) (.*)/', $doc, $matches)) {
+ foreach ($matches[1] as $key => $spec) {
+ $spec = ucfirst($spec);
+ $reflection = new ReflectionClass('Argil_Specification_' . $spec);
+ $args = array_merge(
+ array($value),
+ explode(' ', $matches[2][$key])
+ );
+ $specObj = $reflection->newInstanceArgs($args);
+ if (!$specObj->valid()) {
+ return false;
+ }
+ }
+ }
+
+ return true;
}
}
Modified: branches/experimental/tests/Argil/Reflection/PropertyTest.php
===================================================================
--- branches/experimental/tests/Argil/Reflection/PropertyTest.php 2007-04-01 04:38:34 UTC (rev 513)
+++ branches/experimental/tests/Argil/Reflection/PropertyTest.php 2007-04-01 04:51:45 UTC (rev 514)
@@ -5,8 +5,8 @@
class ArgilSamplePropertyObjectForReflection {
/**
- * @is length <= 10
- * @is length >= 5
+ * @is length 10 <=
+ * @is length 5 >=
*/
public $publicProperty;
protected $protectedProperty;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tsw...@us...> - 2007-04-01 04:38:35
|
Revision: 513
http://argil.svn.sourceforge.net/argil/?rev=513&view=rev
Author: tswicegood
Date: 2007-03-31 21:38:34 -0700 (Sat, 31 Mar 2007)
Log Message:
-----------
Add in exception handling to Length Spec
Modified Paths:
--------------
branches/experimental/src/Argil/Specification/Length.php
branches/experimental/tests/Argil/Specification/LengthTest.php
Modified: branches/experimental/src/Argil/Specification/Length.php
===================================================================
--- branches/experimental/src/Argil/Specification/Length.php 2007-04-01 04:35:56 UTC (rev 512)
+++ branches/experimental/src/Argil/Specification/Length.php 2007-04-01 04:38:34 UTC (rev 513)
@@ -30,5 +30,7 @@
case '!=' :
return $actualLength != $this->_length;
}
+
+ throw new Exception();
}
}
\ No newline at end of file
Modified: branches/experimental/tests/Argil/Specification/LengthTest.php
===================================================================
--- branches/experimental/tests/Argil/Specification/LengthTest.php 2007-04-01 04:35:56 UTC (rev 512)
+++ branches/experimental/tests/Argil/Specification/LengthTest.php 2007-04-01 04:38:34 UTC (rev 513)
@@ -65,4 +65,13 @@
$this->assertFalse($spec->valid());
}
+ public function testThrowsExceptionOnUnknownComparisonType() {
+ $spec = new Argil_Specification_Length('12345', 5, 'unknown');
+ try {
+ $spec->valid();
+ $this->fail('Exception not caught');
+ } catch (Exception $e) {
+ $this->pass('Exception caught');
+ }
+ }
}
\ 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: <tsw...@us...> - 2007-04-01 04:35:55
|
Revision: 512
http://argil.svn.sourceforge.net/argil/?rev=512&view=rev
Author: tswicegood
Date: 2007-03-31 21:35:56 -0700 (Sat, 31 Mar 2007)
Log Message:
-----------
Add in the first pass at a Length Specification object
Added Paths:
-----------
branches/experimental/src/Argil/Specification/
branches/experimental/src/Argil/Specification/Length.php
branches/experimental/tests/Argil/Specification/
branches/experimental/tests/Argil/Specification/LengthTest.php
Added: branches/experimental/src/Argil/Specification/Length.php
===================================================================
--- branches/experimental/src/Argil/Specification/Length.php (rev 0)
+++ branches/experimental/src/Argil/Specification/Length.php 2007-04-01 04:35:56 UTC (rev 512)
@@ -0,0 +1,34 @@
+<?php
+
+class Argil_Specification_Length
+{
+ private
+ $_comparison,
+ $_length,
+ $_value;
+
+ public function __construct($value, $length, $comparison = '==') {
+ $this->_value = $value;
+ $this->_length = $length;
+ $this->_comparison = $comparison;
+ }
+
+ public function valid() {
+ $actualLength = strlen($this->_value);
+ switch ($this->_comparison) {
+ case '==' :
+ return $actualLength == $this->_length;
+ case '<=' :
+ return $actualLength <= $this->_length;
+ case '>=' :
+ return $actualLength >= $this->_length;
+ case '>' :
+ return $actualLength > $this->_length;
+ case '<' :
+ return $actualLength < $this->_length;
+ case '<>' :
+ case '!=' :
+ return $actualLength != $this->_length;
+ }
+ }
+}
\ No newline at end of file
Added: branches/experimental/tests/Argil/Specification/LengthTest.php
===================================================================
--- branches/experimental/tests/Argil/Specification/LengthTest.php (rev 0)
+++ branches/experimental/tests/Argil/Specification/LengthTest.php 2007-04-01 04:35:56 UTC (rev 512)
@@ -0,0 +1,68 @@
+<?php
+
+require_once dirname(__FILE__) . '/../../config.php';
+require_once 'Argil/Specification/Length.php';
+
+class Argil_Specification_LengthTest extends UnitTestCase
+{
+ public function testAllowsLengthEquals() {
+ $spec = new Argil_Specification_Length('12345', 5);
+ $this->assertTrue($spec->valid());
+
+ $spec = new Argil_Specification_Length('123456', 5);
+ $this->assertFalse($spec->valid());
+ }
+
+ public function testAllowsLengthLesserThanOrEquals() {
+ $spec = new Argil_Specification_Length('12345', 5, '<=');
+ $this->assertTrue($spec->valid());
+
+ $spec = new Argil_Specification_Length('1234', 5, '<=');
+ $this->assertTrue($spec->valid());
+
+ $spec = new Argil_Specification_Length('123456', 5, '<=');
+ $this->assertFalse($spec->valid());
+ }
+
+ public function testAllowsLengthGreaterThanOrEquals() {
+ $spec = new Argil_Specification_Length('12345', 4, '>=');
+ $this->assertTrue($spec->valid());
+
+ $spec = new Argil_Specification_Length('1234', 4, '>=');
+ $this->assertTrue($spec->valid());
+
+ $spec = new Argil_Specification_Length('123', 4, '>=');
+ $this->assertFalse($spec->valid());
+ }
+
+ public function testAllowsLengthGreaterThan() {
+ $spec = new Argil_Specification_Length('12345', 4, '>');
+ $this->assertTrue($spec->valid());
+
+ $spec = new Argil_Specification_Length('1234', 4, '>');
+ $this->assertFalse($spec->valid());
+ }
+
+ public function testAllowsLengthLesserThan() {
+ $spec = new Argil_Specification_Length('12345', 6, '<');
+ $this->assertTrue($spec->valid());
+
+ $spec = new Argil_Specification_Length('123456', 6, '<');
+ $this->assertFalse($spec->valid());
+ }
+
+ public function testAllowsBothNotEquals() {
+ $spec = new Argil_Specification_Length('123456', 5, '<>');
+ $this->assertTrue($spec->valid());
+
+ $spec = new Argil_Specification_Length('123456', 5, '!=');
+ $this->assertTrue($spec->valid());
+
+ $spec = new Argil_Specification_Length('12345', 5, '<>');
+ $this->assertFalse($spec->valid());
+
+ $spec = new Argil_Specification_Length('12345', 5, '!=');
+ $this->assertFalse($spec->valid());
+ }
+
+}
\ 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: <tsw...@us...> - 2007-04-01 04:08:20
|
Revision: 511
http://argil.svn.sourceforge.net/argil/?rev=511&view=rev
Author: tswicegood
Date: 2007-03-31 21:08:19 -0700 (Sat, 31 Mar 2007)
Log Message:
-----------
Add a Komodo project file
Added Paths:
-----------
branches/experimental/Argil.kpf
Added: branches/experimental/Argil.kpf
===================================================================
--- branches/experimental/Argil.kpf (rev 0)
+++ branches/experimental/Argil.kpf 2007-04-01 04:08:19 UTC (rev 511)
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Komodo Project File - DO NOT EDIT -->
+<project kpf_version="3" id="3e236782-8105-402b-b29b-41c882a9c592" name="Argil.kpf">
+<preference-set idref="3e236782-8105-402b-b29b-41c882a9c592/tests/AllTest.php">
+ <string id="lastInvocation">default</string>
+<preference-set id="Invocations">
+<preference-set id="default">
+ <string id="cwd"></string>
+ <string id="postparams"></string>
+ <string id="language">PHP</string>
+ <string id="getparams"></string>
+ <string id="phpInterpreterType">php-cli</string>
+ <boolean id="use-console">0</boolean>
+ <string relative="path" id="filename">tests/AllTest.php</string>
+ <string id="mpostparams"></string>
+ <boolean id="show-dialog">1</boolean>
+ <string id="request-method">GET</string>
+ <string id="params"></string>
+ <string id="executable-params"></string>
+ <string id="posttype">application/x-www-form-urlencoded</string>
+ <string id="documentRoot"></string>
+ <string id="cookieparams"></string>
+ <boolean id="enableImplicitFlush">1</boolean>
+ <string id="userEnvironment"></string>
+ <boolean id="sim-cgi">0</boolean>
+ <boolean id="disableOutputBuffering">1</boolean>
+ <string id="userCGIEnvironment"></string>
+</preference-set>
+</preference-set>
+</preference-set>
+<preference-set idref="3e236782-8105-402b-b29b-41c882a9c592/tests/config.php">
+ <string id="lastInvocation">default</string>
+<preference-set id="Invocations">
+<preference-set id="default">
+ <string id="cwd"></string>
+ <string id="postparams"></string>
+ <string id="language">PHP</string>
+ <string id="getparams"></string>
+ <string id="phpInterpreterType">php-cli</string>
+ <boolean id="use-console">0</boolean>
+ <string relative="path" id="filename">tests/config.php</string>
+ <string id="mpostparams"></string>
+ <boolean id="show-dialog">1</boolean>
+ <string id="request-method">GET</string>
+ <string id="params"></string>
+ <string id="executable-params"></string>
+ <string id="posttype">application/x-www-form-urlencoded</string>
+ <string id="documentRoot"></string>
+ <string id="cookieparams"></string>
+ <boolean id="enableImplicitFlush">1</boolean>
+ <string id="userEnvironment"></string>
+ <boolean id="sim-cgi">0</boolean>
+ <boolean id="disableOutputBuffering">1</boolean>
+ <string id="userCGIEnvironment"></string>
+</preference-set>
+</preference-set>
+</preference-set>
+<preference-set idref="3e236782-8105-402b-b29b-41c882a9c592">
+ <boolean id="import_live">1</boolean>
+</preference-set>
+</project>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tsw...@us...> - 2007-04-01 04:07:52
|
Revision: 510
http://argil.svn.sourceforge.net/argil/?rev=510&view=rev
Author: tswicegood
Date: 2007-03-31 21:07:53 -0700 (Sat, 31 Mar 2007)
Log Message:
-----------
Add in a hard-coded example of using docblock parsing for validation
Modified Paths:
--------------
branches/experimental/src/Argil/Reflection/Property.php
branches/experimental/tests/Argil/Reflection/PropertyTest.php
Modified: branches/experimental/src/Argil/Reflection/Property.php
===================================================================
--- branches/experimental/src/Argil/Reflection/Property.php 2007-04-01 04:07:27 UTC (rev 509)
+++ branches/experimental/src/Argil/Reflection/Property.php 2007-04-01 04:07:53 UTC (rev 510)
@@ -14,4 +14,10 @@
$arguments
);
}
+
+ public function isValid($object) {
+ $name = $this->getName();
+ $len = strlen($object->$name);
+ return $len <= 10 && $len >= 5;
+ }
}
Modified: branches/experimental/tests/Argil/Reflection/PropertyTest.php
===================================================================
--- branches/experimental/tests/Argil/Reflection/PropertyTest.php 2007-04-01 04:07:27 UTC (rev 509)
+++ branches/experimental/tests/Argil/Reflection/PropertyTest.php 2007-04-01 04:07:53 UTC (rev 510)
@@ -4,6 +4,10 @@
require_once 'Argil/Reflection/Property.php';
class ArgilSamplePropertyObjectForReflection {
+ /**
+ * @is length <= 10
+ * @is length >= 5
+ */
public $publicProperty;
protected $protectedProperty;
private $privateProperty;
@@ -33,4 +37,24 @@
$this->assertFalse($private->isPublic());
$this->assertFalse($private->isProtected());
}
+
+ public function testUsesDocBlockToDetermineValidity() {
+ $reflection = new ReflectionObject(
+ new ArgilSamplePropertyObjectForReflection()
+ );
+
+ $properties = $reflection->getProperties();
+
+ $public = new Argil_Reflection_Property($properties[0]);
+
+ $object = new ArgilSamplePropertyObjectForReflection();
+ $object->publicProperty = '1234567890';
+ $this->assertTrue($public->isValid($object));
+
+ $object->publicProperty = '12345678901';
+ $this->assertFalse($public->isValid($object));
+
+ $object->publicProperty = '1234';
+ $this->assertFalse($public->isValid($object));
+ }
}
\ 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: <tsw...@us...> - 2007-04-01 04:07:25
|
Revision: 509
http://argil.svn.sourceforge.net/argil/?rev=509&view=rev
Author: tswicegood
Date: 2007-03-31 21:07:27 -0700 (Sat, 31 Mar 2007)
Log Message:
-----------
Add in the new Reflection code to the test suite
Modified Paths:
--------------
branches/experimental/tests/AllTest.php
Modified: branches/experimental/tests/AllTest.php
===================================================================
--- branches/experimental/tests/AllTest.php 2007-04-01 04:05:36 UTC (rev 508)
+++ branches/experimental/tests/AllTest.php 2007-04-01 04:07:27 UTC (rev 509)
@@ -6,6 +6,9 @@
{
public function __construct() {
$this->addTestFile('Argil/Model/ContainerTest.php');
+ $this->addTestFile('Argil/Reflection/ObjectTest.php');
+ $this->addTestFile('Argil/Reflection/PropertyListTest.php');
+ $this->addTestFile('Argil/Reflection/PropertyTest.php');
$this->addTestFile('Argil/RouteTest.php');
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tsw...@us...> - 2007-04-01 04:05:35
|
Revision: 508
http://argil.svn.sourceforge.net/argil/?rev=508&view=rev
Author: tswicegood
Date: 2007-03-31 21:05:36 -0700 (Sat, 31 Mar 2007)
Log Message:
-----------
Make this actually work - not sure how it got commits
Modified Paths:
--------------
branches/experimental/src/Argil/Reflection/Object.php
branches/experimental/tests/Argil/Reflection/ObjectTest.php
Modified: branches/experimental/src/Argil/Reflection/Object.php
===================================================================
--- branches/experimental/src/Argil/Reflection/Object.php 2007-03-26 23:59:40 UTC (rev 507)
+++ branches/experimental/src/Argil/Reflection/Object.php 2007-04-01 04:05:36 UTC (rev 508)
@@ -1,5 +1,7 @@
<?php
+require_once 'Argil/Reflection/PropertyList.php';
+
class Argil_Reflection_Object
{
private $_decorated = null;
@@ -15,4 +17,10 @@
$arguments
);
}
+
+ public function getProperties() {
+ return new Argil_Reflection_PropertyList(
+ $this->_decorated->getProperties()
+ );
+ }
}
\ No newline at end of file
Modified: branches/experimental/tests/Argil/Reflection/ObjectTest.php
===================================================================
--- branches/experimental/tests/Argil/Reflection/ObjectTest.php 2007-03-26 23:59:40 UTC (rev 507)
+++ branches/experimental/tests/Argil/Reflection/ObjectTest.php 2007-04-01 04:05:36 UTC (rev 508)
@@ -17,7 +17,7 @@
);
$properties = $reflection->getProperties();
- $this->assertTrue(is_array($properties));
+ $this->assertTrue(is_array($properties) || $properties instanceof ArrayAccess);
$this->assertTrue(count($properties) == 3);
$this->assertIsA($properties[0], 'Argil_Reflection_Property');
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tsw...@us...> - 2007-03-26 23:59:40
|
Revision: 507
http://argil.svn.sourceforge.net/argil/?rev=507&view=rev
Author: tswicegood
Date: 2007-03-26 16:59:40 -0700 (Mon, 26 Mar 2007)
Log Message:
-----------
Add in some basic wrapper to Reflection that'll be extended for annotations
Added Paths:
-----------
branches/experimental/src/Argil/Reflection/
branches/experimental/src/Argil/Reflection/Object.php
branches/experimental/src/Argil/Reflection/Property.php
branches/experimental/src/Argil/Reflection/PropertyList.php
branches/experimental/tests/Argil/Reflection/
branches/experimental/tests/Argil/Reflection/ObjectTest.php
branches/experimental/tests/Argil/Reflection/PropertyListTest.php
branches/experimental/tests/Argil/Reflection/PropertyTest.php
Added: branches/experimental/src/Argil/Reflection/Object.php
===================================================================
--- branches/experimental/src/Argil/Reflection/Object.php (rev 0)
+++ branches/experimental/src/Argil/Reflection/Object.php 2007-03-26 23:59:40 UTC (rev 507)
@@ -0,0 +1,18 @@
+<?php
+
+class Argil_Reflection_Object
+{
+ private $_decorated = null;
+
+ public function __construct($object) {
+ assert('is_object($object)');
+ $this->_decorated = new ReflectionObject($object);
+ }
+
+ public function __call($method, $arguments) {
+ return call_user_func_array(
+ array($this->_decorated, $method),
+ $arguments
+ );
+ }
+}
\ No newline at end of file
Added: branches/experimental/src/Argil/Reflection/Property.php
===================================================================
--- branches/experimental/src/Argil/Reflection/Property.php (rev 0)
+++ branches/experimental/src/Argil/Reflection/Property.php 2007-03-26 23:59:40 UTC (rev 507)
@@ -0,0 +1,17 @@
+<?php
+
+class Argil_Reflection_Property
+{
+ private $_decorated = null;
+
+ public function __construct(ReflectionProperty $property) {
+ $this->_decorated = $property;
+ }
+
+ public function __call($method, $arguments) {
+ return call_user_func_array(
+ array($this->_decorated, $method),
+ $arguments
+ );
+ }
+}
Added: branches/experimental/src/Argil/Reflection/PropertyList.php
===================================================================
--- branches/experimental/src/Argil/Reflection/PropertyList.php (rev 0)
+++ branches/experimental/src/Argil/Reflection/PropertyList.php 2007-03-26 23:59:40 UTC (rev 507)
@@ -0,0 +1,40 @@
+<?php
+
+require_once 'Argil/Reflection/Property.php';
+
+class Argil_Reflection_PropertyList
+ implements ArrayAccess, Countable, SeekableIterator
+{
+ private $_data = array();
+
+ public function __construct(array $propertyList) {
+ $this->_data = $propertyList;
+ }
+
+ public function offsetExists($offset) {
+ return isset($this->_data[$offset]);
+ }
+
+ public function offsetGet($offset) {
+ return new Argil_Reflection_Property($this->_data[$offset]);
+ }
+
+ public function offsetSet($offset, $value) {
+ throw new Exception();
+ }
+
+ public function offsetUnset($offset) {
+ throw new Exception();
+ }
+
+ public function count() {
+ return count($this->_data);
+ }
+
+ public function seek($index) { }
+ public function current() { }
+ public function key() { }
+ public function next() { }
+ public function rewind() { }
+ public function valid() { }
+}
\ No newline at end of file
Added: branches/experimental/tests/Argil/Reflection/ObjectTest.php
===================================================================
--- branches/experimental/tests/Argil/Reflection/ObjectTest.php (rev 0)
+++ branches/experimental/tests/Argil/Reflection/ObjectTest.php 2007-03-26 23:59:40 UTC (rev 507)
@@ -0,0 +1,25 @@
+<?php
+
+require_once dirname(__FILE__) . '/../../config.php';
+require_once 'Argil/Reflection/Object.php';
+
+class ArgilSampleReflectionObject {
+ public $publicProperty = '';
+ protected $protectedProperty = '';
+ private $privateProperty = '';
+}
+
+class Argil_Reflection_ObjectTest extends UnitTestCase
+{
+ public function testReturnsArrayOfProperties() {
+ $reflection = new Argil_Reflection_Object(
+ new ArgilSampleReflectionObject()
+ );
+ $properties = $reflection->getProperties();
+
+ $this->assertTrue(is_array($properties));
+ $this->assertTrue(count($properties) == 3);
+
+ $this->assertIsA($properties[0], 'Argil_Reflection_Property');
+ }
+}
\ No newline at end of file
Added: branches/experimental/tests/Argil/Reflection/PropertyListTest.php
===================================================================
--- branches/experimental/tests/Argil/Reflection/PropertyListTest.php (rev 0)
+++ branches/experimental/tests/Argil/Reflection/PropertyListTest.php 2007-03-26 23:59:40 UTC (rev 507)
@@ -0,0 +1,83 @@
+<?php
+
+require_once dirname(__FILE__) . '/../../config.php';
+require_once 'Argil/Reflection/PropertyList.php';
+
+class ArgilSampleReflectionObjectForProperties {
+ public $publicProperty = '';
+ protected $protectedProperty = '';
+ private $privateProperty = '';
+}
+
+class Argil_Reflection_PropertyListTest extends UnitTestCase {
+ public function testActsAsArray() {
+ $reflection = new ReflectionObject(
+ new ArgilSampleReflectionObjectForProperties()
+ );
+
+ $properties = new Argil_Reflection_PropertyList(
+ $reflection->getProperties()
+ );
+
+ $this->assertIsA($properties, 'Countable');
+ $this->assertIsA($properties, 'ArrayAccess');
+ $this->assertIsA($properties, 'SeekableIterator');
+
+ // sanity check for Countable
+ $this->assertEqual(3, count($properties));
+
+ // sanity check for ArrayAccess
+ $this->assertTrue(isset($properties[0]));
+ $this->assertNotNull($properties[0]);
+ }
+
+ public function testArrayIsReadOnly() {
+ $reflection = new ReflectionObject(
+ new ArgilSampleReflectionObjectForProperties()
+ );
+
+ $properties = new Argil_Reflection_PropertyList(
+ $reflection->getProperties()
+ );
+
+ try {
+ $properties['unknown'] = "Shouldn't work";
+ $this->fail('Exception not caught');
+ } catch (Exception $e) {
+ $this->pass('Exception caught');
+ }
+
+ try {
+ $this->assertTrue(isset($properties[0]));
+ $properties[0] = "Shouldn't work";
+ $this->fail('Exception not caught');
+ } catch (Exception $e) {
+ $this->pass('Exception caught');
+ }
+
+ try {
+ $this->assertTrue(isset($properties[0]));
+ unset($properties[0]);
+ $this->fail('Exception not caught');
+ } catch (Exception $e) {
+ $this->pass('Exception caught');
+ $this->assertTrue(isset($properties[0]));
+ }
+ }
+
+ public function testMapsAllValuesToArgilWrapper() {
+ $reflection = new ReflectionObject(
+ new ArgilSampleReflectionObjectForProperties()
+ );
+
+ $properties = new Argil_Reflection_PropertyList(
+ $reflection->getProperties()
+ );
+
+ // sanity check
+ $this->assertTrue(isset($properties[0]));
+ $this->assertIsA($properties[0], 'Argil_Reflection_Property');
+
+ $this->assertEqual('publicProperty', $properties[0]->getName());
+ }
+}
\ No newline at end of file
Added: branches/experimental/tests/Argil/Reflection/PropertyTest.php
===================================================================
--- branches/experimental/tests/Argil/Reflection/PropertyTest.php (rev 0)
+++ branches/experimental/tests/Argil/Reflection/PropertyTest.php 2007-03-26 23:59:40 UTC (rev 507)
@@ -0,0 +1,36 @@
+<?php
+
+require_once dirname(__FILE__) . '/../../config.php';
+require_once 'Argil/Reflection/Property.php';
+
+class ArgilSamplePropertyObjectForReflection {
+ public $publicProperty;
+ protected $protectedProperty;
+ private $privateProperty;
+}
+
+class Argil_Reflection_PropertyTest extends UnitTestCase {
+ public function testWrapsReflectionPropertyObject() {
+ $reflection = new ReflectionObject(
+ new ArgilSamplePropertyObjectForReflection()
+ );
+
+ $properties = $reflection->getProperties();
+
+ $public = new Argil_Reflection_Property($properties[0]);
+ $this->assertTrue($public->isPublic());
+ $this->assertFalse($public->isProtected());
+ $this->assertFalse($public->isPrivate());
+ $this->assertEqual($public->getName(), 'publicProperty');
+
+ $protected = new Argil_Reflection_Property($properties[1]);
+ $this->assertTrue($protected->isProtected());
+ $this->assertFalse($protected->isPublic());
+ $this->assertFalse($protected->isPrivate());
+
+ $private = new Argil_Reflection_Property($properties[2]);
+ $this->assertTrue($private->isPrivate());
+ $this->assertFalse($private->isPublic());
+ $this->assertFalse($private->isProtected());
+ }
+}
\ 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: <tsw...@us...> - 2007-03-22 02:03:59
|
Revision: 506
http://argil.svn.sourceforge.net/argil/?rev=506&view=rev
Author: tswicegood
Date: 2007-03-21 19:03:54 -0700 (Wed, 21 Mar 2007)
Log Message:
-----------
Remove ColorTextReporter so this runs more evenly in an IDE setting"
Modified Paths:
--------------
branches/experimental/tests/config.php
Modified: branches/experimental/tests/config.php
===================================================================
--- branches/experimental/tests/config.php 2007-03-21 16:27:57 UTC (rev 505)
+++ branches/experimental/tests/config.php 2007-03-22 02:03:54 UTC (rev 506)
@@ -2,7 +2,6 @@
require_once 'simpletest/unit_tester.php';
require_once 'simpletest/mock_objects.php';
-require_once 'simpletest/ui/colortext_reporter.php';
require_once 'simpletest/autorun.php';
set_include_path(
@@ -10,10 +9,3 @@
dirname(__FILE__) . '/../src' . PATH_SEPARATOR .
get_include_path()
);
-
-if (SimpleReporter::inCli()) {
- SimpleTest::prefer(new ColorTextReporter());
-} else {
- SimpleTest::prefer(new HtmlReporter());
-}
-
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tsw...@us...> - 2007-03-21 16:28:07
|
Revision: 505
http://argil.svn.sourceforge.net/argil/?rev=505&view=rev
Author: tswicegood
Date: 2007-03-21 09:27:57 -0700 (Wed, 21 Mar 2007)
Log Message:
-----------
Add in a TestSuite to run all tests at once
Added Paths:
-----------
branches/experimental/tests/AllTest.php
Added: branches/experimental/tests/AllTest.php
===================================================================
--- branches/experimental/tests/AllTest.php (rev 0)
+++ branches/experimental/tests/AllTest.php 2007-03-21 16:27:57 UTC (rev 505)
@@ -0,0 +1,11 @@
+<?php
+
+require_once dirname(__FILE__) . '/config.php';
+
+class ArgilTestSuite extends TestSuite
+{
+ public function __construct() {
+ $this->addTestFile('Argil/Model/ContainerTest.php');
+ $this->addTestFile('Argil/RouteTest.php');
+ }
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tsw...@us...> - 2007-03-21 16:27:13
|
Revision: 504
http://argil.svn.sourceforge.net/argil/?rev=504&view=rev
Author: tswicegood
Date: 2007-03-21 09:27:06 -0700 (Wed, 21 Mar 2007)
Log Message:
-----------
Add in a Model_Container object
Added Paths:
-----------
branches/experimental/src/Argil/Model/
branches/experimental/src/Argil/Model/Container.php
branches/experimental/tests/Argil/Model/
branches/experimental/tests/Argil/Model/ContainerTest.php
Added: branches/experimental/src/Argil/Model/Container.php
===================================================================
--- branches/experimental/src/Argil/Model/Container.php (rev 0)
+++ branches/experimental/src/Argil/Model/Container.php 2007-03-21 16:27:06 UTC (rev 504)
@@ -0,0 +1,40 @@
+<?php
+
+class Argil_Model_Container
+{
+ private $_contained = array();
+
+ public function __construct() {
+ if (func_num_args() > 0) {
+ foreach (func_get_args() as $object) {
+ $this->_contained[get_class($object)] = $object;
+ }
+ }
+ }
+
+ public function is($name) {
+ return isset($this->_contained[$name]);
+ }
+
+ public function __set($key, $value) {
+ foreach ($this->_contained as $object) {
+ $vars = get_object_vars($object);
+ if (!isset($vars[$key])) {
+ continue;
+ }
+ $object->$key = $value;
+ return;
+ }
+
+ throw new Exception();
+ }
+
+ public function __get($key) {
+ foreach ($this->_contained as $object) {
+ $vars = get_object_vars($object);
+ if (isset($vars[$key])) {
+ return $object->$key;
+ }
+ }
+ }
+}
Added: branches/experimental/tests/Argil/Model/ContainerTest.php
===================================================================
--- branches/experimental/tests/Argil/Model/ContainerTest.php (rev 0)
+++ branches/experimental/tests/Argil/Model/ContainerTest.php 2007-03-21 16:27:06 UTC (rev 504)
@@ -0,0 +1,49 @@
+<?php
+
+require_once dirname(__FILE__) . '/../../config.php';
+require_once 'Argil/Model/Container.php';
+
+class ArgilSampleModel {
+ public $title = '';
+}
+class ArgilSampleModelTwo { }
+
+class Argil_Model_ContainerTest extends UnitTestCase
+{
+ public function testWillTellWhatTypeOfObjectThisContains() {
+ $container = new Argil_Model_Container(
+ new ArgilSampleModel()
+ );
+
+ $this->assertTrue($container->is('ArgilSampleModel'));
+ $this->assertFalse($container->is(__CLASS__));
+ }
+
+ public function testCanContainMultipleObjects() {
+ $container = new Argil_Model_Container(
+ new ArgilSampleModel(),
+ new ArgilSampleModelTwo()
+ );
+
+ $this->assertFalse($container->is(__CLASS__));
+ $this->assertTrue($container->is('ArgilSampleModel'));
+ $this->assertTrue($container->is('ArgilSampleModelTwo'));
+ }
+
+ public function testWillOnlyAllowSettingOfKnownProperties() {
+ $container = new Argil_Model_Container(
+ new ArgilSampleModel()
+ );
+
+ $container->title = 'Hello World';
+ $this->assertEqual($container->title, 'Hello World');
+
+ try {
+ $container->unknown = 'Throw Exception';
+ $this->fail('Exception not caught');
+ } catch (Exception $e) {
+
+ }
+ }
+}
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tsw...@us...> - 2007-03-21 16:25:50
|
Revision: 503
http://argil.svn.sourceforge.net/argil/?rev=503&view=rev
Author: tswicegood
Date: 2007-03-21 09:25:45 -0700 (Wed, 21 Mar 2007)
Log Message:
-----------
Update the include_path to get the tests in the include path too
Modified Paths:
--------------
branches/experimental/tests/config.php
Modified: branches/experimental/tests/config.php
===================================================================
--- branches/experimental/tests/config.php 2007-03-21 16:24:30 UTC (rev 502)
+++ branches/experimental/tests/config.php 2007-03-21 16:25:45 UTC (rev 503)
@@ -5,7 +5,11 @@
require_once 'simpletest/ui/colortext_reporter.php';
require_once 'simpletest/autorun.php';
-set_include_path(dirname(__FILE__) . '/../src' . PATH_SEPARATOR . get_include_path());
+set_include_path(
+ dirname(__FILE__) . PATH_SEPARATOR .
+ dirname(__FILE__) . '/../src' . PATH_SEPARATOR .
+ get_include_path()
+);
if (SimpleReporter::inCli()) {
SimpleTest::prefer(new ColorTextReporter());
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tsw...@us...> - 2007-03-21 16:24:35
|
Revision: 502
http://argil.svn.sourceforge.net/argil/?rev=502&view=rev
Author: tswicegood
Date: 2007-03-21 09:24:30 -0700 (Wed, 21 Mar 2007)
Log Message:
-----------
Rename Route to RouteTest
Added Paths:
-----------
branches/experimental/tests/Argil/RouteTest.php
Removed Paths:
-------------
branches/experimental/tests/Argil/Route.php
Deleted: branches/experimental/tests/Argil/Route.php
===================================================================
--- branches/experimental/tests/Argil/Route.php 2007-03-21 15:52:47 UTC (rev 501)
+++ branches/experimental/tests/Argil/Route.php 2007-03-21 16:24:30 UTC (rev 502)
@@ -1,29 +0,0 @@
-<?php
-
-require_once dirname(__FILE__) . '/../config.php';
-require_once 'Argil/Route.php';
-
-class ArgilCallbackObject {
- public function callback() { }
-}
-
-Mock::generate('ArgilCallbackObject');
-
-class Argil_RouteTest extends UnitTestCase
-{
- public function testBasicCallback() {
- $mock = new MockArgilCallbackObject();
- $mock->expectOnce('callback');
-
- $route = new Argil_Route(
- array(
- $mock,
- 'callback'
- )
- );
-
- $route->execute();
- }
-}
-
-
Copied: branches/experimental/tests/Argil/RouteTest.php (from rev 501, branches/experimental/tests/Argil/Route.php)
===================================================================
--- branches/experimental/tests/Argil/RouteTest.php (rev 0)
+++ branches/experimental/tests/Argil/RouteTest.php 2007-03-21 16:24:30 UTC (rev 502)
@@ -0,0 +1,29 @@
+<?php
+
+require_once dirname(__FILE__) . '/../config.php';
+require_once 'Argil/Route.php';
+
+class ArgilCallbackObject {
+ public function callback() { }
+}
+
+Mock::generate('ArgilCallbackObject');
+
+class Argil_RouteTest extends UnitTestCase
+{
+ public function testBasicCallback() {
+ $mock = new MockArgilCallbackObject();
+ $mock->expectOnce('callback');
+
+ $route = new Argil_Route(
+ array(
+ $mock,
+ 'callback'
+ )
+ );
+
+ $route->execute();
+ }
+}
+
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tsw...@us...> - 2007-03-21 15:52:47
|
Revision: 501
http://argil.svn.sourceforge.net/argil/?rev=501&view=rev
Author: tswicegood
Date: 2007-03-21 08:52:47 -0700 (Wed, 21 Mar 2007)
Log Message:
-----------
Add in the experimental branch with a base Route object
Added Paths:
-----------
branches/experimental/
branches/experimental/public/
branches/experimental/src/
branches/experimental/src/Argil/
branches/experimental/src/Argil/Route.php
branches/experimental/tests/
branches/experimental/tests/Argil/
branches/experimental/tests/Argil/Route.php
branches/experimental/tests/config.php
Added: branches/experimental/src/Argil/Route.php
===================================================================
--- branches/experimental/src/Argil/Route.php (rev 0)
+++ branches/experimental/src/Argil/Route.php 2007-03-21 15:52:47 UTC (rev 501)
@@ -0,0 +1,14 @@
+<?php
+
+class Argil_Route
+{
+ private $_callback = null;
+
+ public function __construct($callback) {
+ $this->_callback = $callback;
+ }
+
+ public function execute() {
+ call_user_func($this->_callback);
+ }
+}
Added: branches/experimental/tests/Argil/Route.php
===================================================================
--- branches/experimental/tests/Argil/Route.php (rev 0)
+++ branches/experimental/tests/Argil/Route.php 2007-03-21 15:52:47 UTC (rev 501)
@@ -0,0 +1,29 @@
+<?php
+
+require_once dirname(__FILE__) . '/../config.php';
+require_once 'Argil/Route.php';
+
+class ArgilCallbackObject {
+ public function callback() { }
+}
+
+Mock::generate('ArgilCallbackObject');
+
+class Argil_RouteTest extends UnitTestCase
+{
+ public function testBasicCallback() {
+ $mock = new MockArgilCallbackObject();
+ $mock->expectOnce('callback');
+
+ $route = new Argil_Route(
+ array(
+ $mock,
+ 'callback'
+ )
+ );
+
+ $route->execute();
+ }
+}
+
+
Added: branches/experimental/tests/config.php
===================================================================
--- branches/experimental/tests/config.php (rev 0)
+++ branches/experimental/tests/config.php 2007-03-21 15:52:47 UTC (rev 501)
@@ -0,0 +1,15 @@
+<?php
+
+require_once 'simpletest/unit_tester.php';
+require_once 'simpletest/mock_objects.php';
+require_once 'simpletest/ui/colortext_reporter.php';
+require_once 'simpletest/autorun.php';
+
+set_include_path(dirname(__FILE__) . '/../src' . PATH_SEPARATOR . get_include_path());
+
+if (SimpleReporter::inCli()) {
+ SimpleTest::prefer(new ColorTextReporter());
+} else {
+ SimpleTest::prefer(new HtmlReporter());
+}
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tsw...@us...> - 2007-03-03 20:59:37
|
Revision: 500
http://argil.svn.sourceforge.net/argil/?rev=500&view=rev
Author: tswicegood
Date: 2007-03-03 12:59:31 -0800 (Sat, 03 Mar 2007)
Log Message:
-----------
Playing with some new model ideas
Added Paths:
-----------
branches/tswicegood-newmodel/
branches/tswicegood-newmodel/build.xml
branches/tswicegood-newmodel/docs/ArgilAjaxApi
branches/tswicegood-newmodel/docs/CodingStandard
branches/tswicegood-newmodel/docs/HowTos/BookmarkApp
branches/tswicegood-newmodel/docs/HowTos/HelloWorld
branches/tswicegood-newmodel/docs/InstallingArgil
branches/tswicegood-newmodel/docs/Manifesto
branches/tswicegood-newmodel/docs/OneMinuteTutorial
branches/tswicegood-newmodel/misc/build.properties
branches/tswicegood-newmodel/public/index.php
branches/tswicegood-newmodel/scripts/argil
branches/tswicegood-newmodel/src/Argil/
branches/tswicegood-newmodel/src/Argil/Xml/ArgilNsCleaner.php
branches/tswicegood-newmodel/src/ArgilCore/
branches/tswicegood-newmodel/src/ArgilCore/Controllers/DemoController.php
branches/tswicegood-newmodel/src/ArgilCore/Helpers/Grid.php
branches/tswicegood-newmodel/src/ArgilCore/PageTypes/Html/default.php
branches/tswicegood-newmodel/src/ArgilCore/Public/
branches/tswicegood-newmodel/src/ArgilCore/Public/css/drawer.css
branches/tswicegood-newmodel/src/ArgilCore/Public/css/layout.css
branches/tswicegood-newmodel/src/ArgilCore/Public/scripts/argil.moo.js
branches/tswicegood-newmodel/src/ArgilCore/Public/scripts/mootools.full.v1.00.js
branches/tswicegood-newmodel/src/ArgilCore/Views/Demo/
branches/tswicegood-newmodel/src/ArgilCore/Views/Demo/drawer.php
branches/tswicegood-newmodel/src/ArgilImpl/
branches/tswicegood-newmodel/src/ArgilSample/
branches/tswicegood-newmodel/src/ArgilSample/sample.config.php
branches/tswicegood-newmodel/tests/AllTests.php
branches/tswicegood-newmodel/tests/Argil/
branches/tswicegood-newmodel/tests/Argil/Database/Reflection/TableTest.php
branches/tswicegood-newmodel/tests/Argil/Model/MapperTest.php
branches/tswicegood-newmodel/tests/Argil/Model/MetaTest.php
branches/tswicegood-newmodel/tests/Argil/Model/Relationship/MapperTest.php
branches/tswicegood-newmodel/tests/Argil/ModelListTest.php
branches/tswicegood-newmodel/tests/Argil/ModelTest.php
branches/tswicegood-newmodel/tests/Argil/Xml/ArgilNsCleanerTest.php
branches/tswicegood-newmodel/tests/ArgilCore/
branches/tswicegood-newmodel/tests/ArgilCore/Models/Finders/AllTest.php
branches/tswicegood-newmodel/tests/ArgilCore/Models/Finders/OneTest.php
branches/tswicegood-newmodel/tests/ArgilSample/
branches/tswicegood-newmodel/tests/ArgilSample/TestCase.php
branches/tswicegood-newmodel/tests/ArgilUnitTest.config.php
branches/tswicegood-newmodel/tests/support/Widget/Controllers/AuthRequiredController.php
branches/tswicegood-newmodel/tests/support/Widget/Controllers/SimpleController.php
branches/tswicegood-newmodel/tests/support/Widget/Controllers/SubController.php
branches/tswicegood-newmodel/tests/support/Widget/Controllers/WidgetController.php
branches/tswicegood-newmodel/tests/support/Widget/Models/Mappers/SubMapper.php
branches/tswicegood-newmodel/tests/support/Widget/Models/Mappers/WidgetMapper.php
branches/tswicegood-newmodel/tests/support/Widget/Models/Metas/SubMeta.php
branches/tswicegood-newmodel/tests/support/Widget/Models/Metas/WidgetMeta.php
branches/tswicegood-newmodel/tests/support/Widget/Models/Sub.php
branches/tswicegood-newmodel/tests/support/Widget/Models/SubList.php
branches/tswicegood-newmodel/tests/support/Widget/Models/Widget.php
branches/tswicegood-newmodel/tests/support/Widget/Models/WidgetList.php
Removed Paths:
-------------
branches/tswicegood-newmodel/build.xml
branches/tswicegood-newmodel/docs/CodingStandard
branches/tswicegood-newmodel/docs/HowTos/BookmarkApp
branches/tswicegood-newmodel/docs/HowTos/HelloWorld
branches/tswicegood-newmodel/docs/InstallingPipes
branches/tswicegood-newmodel/docs/Manifesto
branches/tswicegood-newmodel/docs/OneMinuteTutorial
branches/tswicegood-newmodel/docs/PipesAjaxApi
branches/tswicegood-newmodel/misc/build.properties
branches/tswicegood-newmodel/public/index.php
branches/tswicegood-newmodel/scripts/pipes
branches/tswicegood-newmodel/src/Argil/Xml/PipesNsCleaner.php
branches/tswicegood-newmodel/src/ArgilCore/Helpers/Grid.php
branches/tswicegood-newmodel/src/ArgilCore/PageTypes/Html/default.php
branches/tswicegood-newmodel/src/ArgilCore/Public/
branches/tswicegood-newmodel/src/ArgilCore/Public/css/layout.css
branches/tswicegood-newmodel/src/ArgilCore/Public/scripts/argil.moo.js
branches/tswicegood-newmodel/src/ArgilCore/Public/scripts/mootools.full.v1.00.js
branches/tswicegood-newmodel/src/ArgilCore/Views/Demo/drawer.php
branches/tswicegood-newmodel/src/ArgilSample/sample.config.php
branches/tswicegood-newmodel/src/Pipes/
branches/tswicegood-newmodel/src/PipesCore/
branches/tswicegood-newmodel/src/PipesImpl/
branches/tswicegood-newmodel/src/PipesSample/
branches/tswicegood-newmodel/tests/AllTests.php
branches/tswicegood-newmodel/tests/Argil/Database/Reflection/TableTest.php
branches/tswicegood-newmodel/tests/Argil/Model/MapperTest.php
branches/tswicegood-newmodel/tests/Argil/Model/MetaTest.php
branches/tswicegood-newmodel/tests/Argil/Model/Relationship/MapperTest.php
branches/tswicegood-newmodel/tests/Argil/ModelListTest.php
branches/tswicegood-newmodel/tests/Argil/ModelTest.php
branches/tswicegood-newmodel/tests/Argil/Xml/PipesNsCleanerTest.php
branches/tswicegood-newmodel/tests/ArgilCore/Models/Finders/AllTest.php
branches/tswicegood-newmodel/tests/ArgilCore/Models/Finders/OneTest.php
branches/tswicegood-newmodel/tests/ArgilSample/TestCase.php
branches/tswicegood-newmodel/tests/Pipes/
branches/tswicegood-newmodel/tests/PipesCore/
branches/tswicegood-newmodel/tests/PipesSample/
branches/tswicegood-newmodel/tests/PipesUnitTest.config.php
branches/tswicegood-newmodel/tests/support/Widget/Controllers/AuthRequiredController.php
branches/tswicegood-newmodel/tests/support/Widget/Controllers/SimpleController.php
branches/tswicegood-newmodel/tests/support/Widget/Controllers/SubController.php
branches/tswicegood-newmodel/tests/support/Widget/Controllers/WidgetController.php
branches/tswicegood-newmodel/tests/support/Widget/Models/Mappers/SubMapper.php
branches/tswicegood-newmodel/tests/support/Widget/Models/Mappers/WidgetMapper.php
branches/tswicegood-newmodel/tests/support/Widget/Models/Metas/SubMeta.php
branches/tswicegood-newmodel/tests/support/Widget/Models/Metas/WidgetMeta.php
branches/tswicegood-newmodel/tests/support/Widget/Models/Sub.php
branches/tswicegood-newmodel/tests/support/Widget/Models/SubList.php
branches/tswicegood-newmodel/tests/support/Widget/Models/Widget.php
branches/tswicegood-newmodel/tests/support/Widget/Models/WidgetList.php
Copied: branches/tswicegood-newmodel (from rev 477, trunk)
Deleted: branches/tswicegood-newmodel/build.xml
===================================================================
--- trunk/build.xml 2007-02-13 19:38:46 UTC (rev 477)
+++ branches/tswicegood-newmodel/build.xml 2007-03-03 20:59:31 UTC (rev 500)
@@ -1,306 +0,0 @@
-<?xml version="1.0" ?>
-<!--
- This is the build.xml file for Phing that is used to create packages of the
- currently checked out code.
--->
-
-<project name="Pipes" basedir="." default="Pipes.pear">
- <property file="${project.basedir}/misc/build.properties" />
-
- <!--
-
- -->
-
- <target name="all">
- <phingcall target="Pipes.pear" />
- <phingcall target="PipesImpl.pear" />
- <phingcall target="PipesCore.pear" />
- </target>
-
- <target name="prepare">
- <echo>Preparing build directory structure</echo>
- <mkdir dir="${pipes.build.basedir}" />
- </target>
-
- <target name="prepare.src" depends="prepare">
- <echo message="Preparing source directory structure..." />
- <mkdir dir="${pipes.build.src.basedir}" />
- </target>
-
- <target name="prepare.tests" depends="prepare">
- <echo message="Preparing tests" />
- <delete dir="${pipes.build.tests.basedir}" />
- <mkdir dir="${pipes.build.tests.basedir}" />
- <copy todir="${pipes.build.tests.basedir}">
- <fileset dir="${pipes.tests.basedir}">
- <include name="*.php" />
- </fileset>
- </copy>
- <exec command="svn export ${pipes.tests.support} ${pipes.build.tests.support}" />
- <property name="tests.prepared" value="true" />
- </target>
-
- <target name="prepare.pear" depends="prepare">
- <echo message="Preparing PEAR build directory..." />
- <delete dir="${pipes.build.pear.basedir}" />
- <mkdir dir="${pipes.build.pear.basedir}" />
- </target>
-
- <target name="clean">
- <echo>Cleaning out previous build...</echo>
- <delete dir="${pipes.build.basedir}" />
- <phingcall target="prepare" />
- </target>
-
- <target name="PipesImpl.src.prepare" depends="prepare.src">
- <echo message="Preparing PipesImpl source code..." />
- <exec command="svn export ${pipes.src.PipesImpl} ${pipes.build.src.PipesImpl}" />
- </target>
-
- <target name="PipesCore.src.prepare" depends="prepare.src">
- <echo message="Preparing PipesCore source code..." />
- <exec command="svn export ${pipes.src.PipesCore} ${pipes.build.src.PipesCore}" />
- </target>
-
- <target name="PipesImpl.pear" depends="prepare">
- <phingcall target="PipesImpl.pear.prepare" />
- <phingcall target="PipesImpl.pear.package" />
- <phingcall target="PipesImpl.pear.tar" />
- </target>
-
- <target name="PipesImpl.pear.prepare" depends="PipesImpl.src.prepare">
- <phingcall target="prepare.pear" />
- <echo message="Preparing PipesImpl source code for PEAR packaging..." />
- <copy todir="${pipes.build.pear.PipesImpl}">
- <fileset dir="${pipes.build.src.PipesImpl}">
- <include name="**" />
- </fileset>
- </copy>
- </target>
-
- <target name="PipesImpl.pear.package" depends="PipesImpl.pear.prepare">
- <echo>Building PEAR package.xml file</echo>
- <pearpkg name="PipesImpl" dir="${pipes.build.pear.PipesImpl}" destFile="${pipes.build.pear.basedir}/package.xml">
- <fileset dir="${pipes.build.pear.PipesImpl}">
- <include name="**/*" />
- </fileset>
-
- <option name="notes">Nothing here yet</option>
- <option name="description">PipesImpl: Better Plumbing Interfaces</option>
- <option name="summary">
- Provides all of the Interfaces for Pipes
- </option>
- <option name="version" value="${PipesImpl.version}" />
- <option name="state" value="alpha" />
- <option name="license" value="LGPL" />
-
- <mapping name="maintainers">
- <element>
- <element key="handle" value="tswicegood" />
- <element key="name" value="Travis Swicegood" />
- <element key="email" value="development [at] domain51 [dot] com" />
- <element key="role" value="lead" />
- </element>
- </mapping>
-
- <mapping name="deps">
- <element>
- <element key="type" value="php" />
- <element key="version" value="5.1.6" />
- <element key="rel" value="ge" />
- </element>
- </mapping>
- </pearpkg>
-
- <echo>Converting package.xml 1.0 to package.xml 2.0</echo>
- <exec command="pear convert ${pipes.build.pear.basedir}/package.xml" dir="${pipes.build.pear.basedir}" />
-
- <echo>Replacing old package.xml 1.0 with new</echo>
- <move file="${pipes.build.pear.basedir}/package2.xml" tofile="${pipes.build.pear.basedir}/package.xml" overwrite="true" />
- <delete file="${pipes.build.pear.basedir}/package2.xml" />
- </target>
-
- <target name="PipesImpl.pear.tar" depends="PipesImpl.pear.package">
- <echo>Creating pear tar.gz file</echo>
- <delete file="${pipes.package.pear.PipesImpl}" />
- <tar compression="gzip" destfile="${pipes.package.pear.PipesImpl}" basedir="${pipes.build.pear.basedir}" />
- </target>
-
- <!--
- Begin PipesCore PEAR Package
- -->
-
- <target name="PipesCore.pear" depends="prepare">
- <phingcall target="PipesCore.tests.run" />
- <phingcall target="PipesCore.pear.prepare" />
- <phingcall target="PipesCore.pear.package" />
- <phingcall target="PipesCore.pear.tar" />
- </target>
-
- <target name="PipesCore.tests.prepare" depends="prepare.tests">
- <echo message="Preparing Pipes unit tests..." />
- <exec command="svn export ${pipes.tests.PipesCore} ${pipes.build.tests.PipesCore}" />
- </target>
-
- <target name="PipesCore.tests.run" depends="PipesCore.tests.prepare, Pipes.src.prepare">
- <echo message="Running Pipes unit tests..." />
- <exec command="phpunit AllTests ${pipes.build.tests.basedir}/AllTests.php" checkreturn="true" passthru="true"/>
- </target>
-
- <target name="PipesCore.pear.prepare" depends="PipesCore.src.prepare">
- <phingcall target="prepare.pear" />
- <echo message="Preparing PipesCore source code for PEAR packaging..." />
- <copy todir="${pipes.build.pear.PipesCore}">
- <fileset dir="${pipes.build.src.PipesCore}">
- <include name="**" />
- </fileset>
- </copy>
- </target>
-
- <target name="PipesCore.pear.package" depends="PipesCore.pear.prepare">
- <echo>Building PEAR package.xml file</echo>
- <pearpkg name="PipesCore" dir="${pipes.build.pear.PipesCore}" destFile="${pipes.build.pear.basedir}/package.xml">
- <fileset dir="${pipes.build.pear.PipesCore}">
- <include name="**/*" />
- </fileset>
-
- <option name="notes">Nothing here yet</option>
- <option name="description">PipesImpl: Better Plumbing Interfaces</option>
- <option name="summary">
- Provides all of the Interfaces for Pipes
- </option>
- <option name="version" value="${PipesCore.version}" />
- <option name="state" value="alpha" />
- <option name="license" value="LGPL" />
-
- <mapping name="maintainers">
- <element>
- <element key="handle" value="tswicegood" />
- <element key="name" value="Travis Swicegood" />
- <element key="email" value="development [at] domain51 [dot] com" />
- <element key="role" value="lead" />
- </element>
- </mapping>
-
- <mapping name="deps">
- <element>
- <element key="type" value="php" />
- <element key="version" value="5.1.6" />
- <element key="rel" value="ge" />
- </element>
- </mapping>
- </pearpkg>
-
- <echo>Converting package.xml 1.0 to package.xml 2.0</echo>
- <exec command="pear convert ${pipes.build.pear.basedir}/package.xml" dir="${pipes.build.pear.basedir}" />
-
- <echo>Replacing old package.xml 1.0 with new</echo>
- <move file="${pipes.build.pear.basedir}/package2.xml" tofile="${pipes.build.pear.basedir}/package.xml" overwrite="true" />
- <delete file="${pipes.build.pear.basedir}/package2.xml" />
- </target>
-
- <target name="PipesCore.pear.tar" depends="PipesCore.pear.package">
- <echo>Creating pear tar.gz file</echo>
- <delete file="${pipes.package.pear.PipesCore}" />
- <tar compression="gzip" destfile="${pipes.package.pear.PipesCore}" basedir="${pipes.build.pear.basedir}" />
- </target>
-
-
-
- <!--
- Begin Pipes PEAR Package creation
- -->
-
- <target name="Pipes.pear" depends="prepare">
- <phingcall target="Pipes.tests.run" />
- <phingcall target="Pipes.pear.prepare" />
- <phingcall target="Pipes.pear.package" />
- <phingcall target="Pipes.pear.tar" />
- </target>
-
- <target name="Pipes.src.prepare" depends="prepare.src, PipesImpl.src.prepare, PipesCore.src.prepare">
- <echo message="Exporting Pipes source code..." />
- <exec command="svn export ${pipes.src.pipesdir} ${pipes.build.src.pipes}" />
- </target>
-
- <target name="Pipes.tests.prepare" depends="prepare.tests">
- <echo message="Preparing Pipes unit tests..." />
- <exec command="svn export ${pipes.tests.pipes} ${pipes.build.tests.pipes}" />
- </target>
-
- <target name="Pipes.tests.run" depends="Pipes.tests.prepare, Pipes.src.prepare">
- <echo message="Running Pipes unit tests..." />
- <exec command="phpunit AllTests ${pipes.build.tests.basedir}/AllTests.php" checkreturn="true" passthru="true"/>
- </target>
-
- <target name="Pipes.pear.prepare" depends="Pipes.src.prepare">
- <echo message="Preparing source code for PEAR packaging..." />
- <copy todir="${pipes.build.pear.Pipes}">
- <fileset dir="${pipes.build.src.pipes}">
- <include name="**" />
- </fileset>
- </copy>
- </target>
-
- <target name="Pipes.pear.package" depends="Pipes.pear.prepare">
- <echo>Building PEAR package.xml file</echo>
- <pearpkg name="Pipes" dir="${pipes.build.pear.Pipes}" destFile="${pipes.build.pear.basedir}/package.xml">
- <fileset dir="${pipes.build.pear.Pipes}">
- <include name="**/*" />
- </fileset>
-
- <option name="notes">Nothing here yet</option>
- <option name="description">Pipes: Better Plumbing</option>
- <option name="summary">
- Pipes provides a rapid application development framework to get code up and running quickly
- </option>
- <option name="version" value="${pipes.version}" />
- <option name="state" value="alpha" />
- <option name="license" value="LGPL" />
-
- <mapping name="maintainers">
- <element>
- <element key="handle" value="tswicegood" />
- <element key="name" value="Travis Swicegood" />
- <element key="email" value="development [at] domain51 [dot] com" />
- <element key="role" value="lead" />
- </element>
- </mapping>
-
- <mapping name="deps">
- <element>
- <element key="type" value="php" />
- <element key="version" value="5.1.6" />
- <element key="rel" value="ge" />
- </element>
- <element>
- <element key="type" value="pkg" />
- <element key="version" value="${pipes.version}" />
- <element key="rel" value="eq" />
- <element key="name" value="PipesImpl" />
- </element>
- <element>
- <element key="type" value="pkg" />
- <element key="version" value="${pipes.version}" />
- <element key="rel" value="eq" />
- <element key="name" value="PipesCore" />
- </element>
- </mapping>
- </pearpkg>
-
- <echo>Converting package.xml 1.0 to package.xml 2.0</echo>
- <exec command="pear convert ${pipes.build.pear.basedir}/package.xml" dir="${pipes.build.pear.basedir}" />
-
- <echo>Replacing old package.xml 1.0 with new</echo>
- <move file="${pipes.build.pear.basedir}/package2.xml" tofile="${pipes.build.pear.basedir}/package.xml" overwrite="true" />
- <delete file="${pipes.build.pear.basedir}/package2.xml" />
-
- </target>
-
- <target name="Pipes.pear.tar" depends="Pipes.pear.package">
- <echo>Creating pear tar.gz file</echo>
- <delete file="${pipes.build.pear.tarfile}" />
- <tar compression="gzip" destfile="${pipes.build.pear.tarfile}" basedir="${pipes.build.pear.basedir}" />
- </target>
-
-</project>
Copied: branches/tswicegood-newmodel/build.xml (from rev 482, trunk/build.xml)
===================================================================
--- branches/tswicegood-newmodel/build.xml (rev 0)
+++ branches/tswicegood-newmodel/build.xml 2007-03-03 20:59:31 UTC (rev 500)
@@ -0,0 +1,306 @@
+<?xml version="1.0" ?>
+<!--
+ This is the build.xml file for Phing that is used to create packages of the
+ currently checked out code.
+-->
+
+<project name="Argil" basedir="." default="all">
+ <property file="${project.basedir}/misc/build.properties" />
+
+ <!--
+
+ -->
+
+ <target name="all">
+ <phingcall target="Argil.pear" />
+ <phingcall target="ArgilImpl.pear" />
+ <phingcall target="ArgilCore.pear" />
+ </target>
+
+ <target name="prepare">
+ <echo>Preparing build directory structure</echo>
+ <mkdir dir="${argil.build.basedir}" />
+ </target>
+
+ <target name="prepare.src" depends="prepare">
+ <echo message="Preparing source directory structure..." />
+ <mkdir dir="${argil.build.src.basedir}" />
+ </target>
+
+ <target name="prepare.tests" depends="prepare">
+ <echo message="Preparing tests" />
+ <delete dir="${argil.build.tests.basedir}" />
+ <mkdir dir="${argil.build.tests.basedir}" />
+ <copy todir="${argil.build.tests.basedir}">
+ <fileset dir="${argil.tests.basedir}">
+ <include name="*.php" />
+ </fileset>
+ </copy>
+ <exec command="svn export ${argil.tests.support} ${argil.build.tests.support}" />
+ <property name="tests.prepared" value="true" />
+ </target>
+
+ <target name="prepare.pear" depends="prepare">
+ <echo message="Preparing PEAR build directory..." />
+ <delete dir="${argil.build.pear.basedir}" />
+ <mkdir dir="${argil.build.pear.basedir}" />
+ </target>
+
+ <target name="clean">
+ <echo>Cleaning out previous build...</echo>
+ <delete dir="${argil.build.basedir}" />
+ <phingcall target="prepare" />
+ </target>
+
+ <target name="ArgilImpl.src.prepare" depends="prepare.src">
+ <echo message="Preparing ArgilImpl source code..." />
+ <exec command="svn export ${argil.src.ArgilImpl} ${argil.build.src.ArgilImpl}" />
+ </target>
+
+ <target name="ArgilCore.src.prepare" depends="prepare.src">
+ <echo message="Preparing ArgilCore source code..." />
+ <exec command="svn export ${argil.src.ArgilCore} ${argil.build.src.ArgilCore}" />
+ </target>
+
+ <target name="ArgilImpl.pear" depends="prepare">
+ <phingcall target="ArgilImpl.pear.prepare" />
+ <phingcall target="ArgilImpl.pear.package" />
+ <phingcall target="ArgilImpl.pear.tar" />
+ </target>
+
+ <target name="ArgilImpl.pear.prepare" depends="ArgilImpl.src.prepare">
+ <phingcall target="prepare.pear" />
+ <echo message="Preparing ArgilImpl source code for PEAR packaging..." />
+ <copy todir="${argil.build.pear.ArgilImpl}">
+ <fileset dir="${argil.build.src.ArgilImpl}">
+ <include name="**" />
+ </fileset>
+ </copy>
+ </target>
+
+ <target name="ArgilImpl.pear.package" depends="ArgilImpl.pear.prepare">
+ <echo>Building PEAR package.xml file</echo>
+ <pearpkg name="ArgilImpl" dir="${argil.build.pear.ArgilImpl}" destFile="${argil.build.pear.basedir}/package.xml">
+ <fileset dir="${argil.build.pear.ArgilImpl}">
+ <include name="**/*" />
+ </fileset>
+
+ <option name="notes">Nothing here yet</option>
+ <option name="description">ArgilImpl: Better Plumbing Interfaces</option>
+ <option name="summary">
+ Provides all of the Interfaces for Argil
+ </option>
+ <option name="version" value="${ArgilImpl.version}" />
+ <option name="state" value="alpha" />
+ <option name="license" value="LGPL" />
+
+ <mapping name="maintainers">
+ <element>
+ <element key="handle" value="tswicegood" />
+ <element key="name" value="Travis Swicegood" />
+ <element key="email" value="development [at] domain51 [dot] com" />
+ <element key="role" value="lead" />
+ </element>
+ </mapping>
+
+ <mapping name="deps">
+ <element>
+ <element key="type" value="php" />
+ <element key="version" value="5.1.6" />
+ <element key="rel" value="ge" />
+ </element>
+ </mapping>
+ </pearpkg>
+
+ <echo>Converting package.xml 1.0 to package.xml 2.0</echo>
+ <exec command="pear convert ${argil.build.pear.basedir}/package.xml" dir="${argil.build.pear.basedir}" />
+
+ <echo>Replacing old package.xml 1.0 with new</echo>
+ <move file="${argil.build.pear.basedir}/package2.xml" tofile="${argil.build.pear.basedir}/package.xml" overwrite="true" />
+ <delete file="${argil.build.pear.basedir}/package2.xml" />
+ </target>
+
+ <target name="ArgilImpl.pear.tar" depends="ArgilImpl.pear.package">
+ <echo>Creating pear tar.gz file</echo>
+ <delete file="${argil.package.pear.ArgilImpl}" />
+ <tar compression="gzip" destfile="${argil.package.pear.ArgilImpl}" basedir="${argil.build.pear.basedir}" />
+ </target>
+
+ <!--
+ Begin ArgilCore PEAR Package
+ -->
+
+ <target name="ArgilCore.pear" depends="prepare">
+ <phingcall target="ArgilCore.tests.run" />
+ <phingcall target="ArgilCore.pear.prepare" />
+ <phingcall target="ArgilCore.pear.package" />
+ <phingcall target="ArgilCore.pear.tar" />
+ </target>
+
+ <target name="ArgilCore.tests.prepare" depends="prepare.tests">
+ <echo message="Preparing Argil unit tests..." />
+ <exec command="svn export ${argil.tests.ArgilCore} ${argil.build.tests.ArgilCore}" />
+ </target>
+
+ <target name="ArgilCore.tests.run" depends="ArgilCore.tests.prepare, Argil.src.prepare">
+ <echo message="Running Argil unit tests..." />
+ <exec command="phpunit AllTests ${argil.build.tests.basedir}/AllTests.php" checkreturn="true" passthru="true"/>
+ </target>
+
+ <target name="ArgilCore.pear.prepare" depends="ArgilCore.src.prepare">
+ <phingcall target="prepare.pear" />
+ <echo message="Preparing ArgilCore source code for PEAR packaging..." />
+ <copy todir="${argil.build.pear.ArgilCore}">
+ <fileset dir="${argil.build.src.ArgilCore}">
+ <include name="**" />
+ </fileset>
+ </copy>
+ </target>
+
+ <target name="ArgilCore.pear.package" depends="ArgilCore.pear.prepare">
+ <echo>Building PEAR package.xml file</echo>
+ <pearpkg name="ArgilCore" dir="${argil.build.pear.ArgilCore}" destFile="${argil.build.pear.basedir}/package.xml">
+ <fileset dir="${argil.build.pear.ArgilCore}">
+ <include name="**/*" />
+ </fileset>
+
+ <option name="notes">Nothing here yet</option>
+ <option name="description">ArgilImpl: Better Plumbing Interfaces</option>
+ <option name="summary">
+ Provides all of the Interfaces for Argil
+ </option>
+ <option name="version" value="${ArgilCore.version}" />
+ <option name="state" value="alpha" />
+ <option name="license" value="LGPL" />
+
+ <mapping name="maintainers">
+ <element>
+ <element key="handle" value="tswicegood" />
+ <element key="name" value="Travis Swicegood" />
+ <element key="email" value="development [at] domain51 [dot] com" />
+ <element key="role" value="lead" />
+ </element>
+ </mapping>
+
+ <mapping name="deps">
+ <element>
+ <element key="type" value="php" />
+ <element key="version" value="5.1.6" />
+ <element key="rel" value="ge" />
+ </element>
+ </mapping>
+ </pearpkg>
+
+ <echo>Converting package.xml 1.0 to package.xml 2.0</echo>
+ <exec command="pear convert ${argil.build.pear.basedir}/package.xml" dir="${argil.build.pear.basedir}" />
+
+ <echo>Replacing old package.xml 1.0 with new</echo>
+ <move file="${argil.build.pear.basedir}/package2.xml" tofile="${argil.build.pear.basedir}/package.xml" overwrite="true" />
+ <delete file="${argil.build.pear.basedir}/package2.xml" />
+ </target>
+
+ <target name="ArgilCore.pear.tar" depends="ArgilCore.pear.package">
+ <echo>Creating pear tar.gz file</echo>
+ <delete file="${argil.package.pear.ArgilCore}" />
+ <tar compression="gzip" destfile="${argil.package.pear.ArgilCore}" basedir="${argil.build.pear.basedir}" />
+ </target>
+
+
+
+ <!--
+ Begin Argil PEAR Package creation
+ -->
+
+ <target name="Argil.pear" depends="prepare">
+ <phingcall target="Argil.tests.run" />
+ <phingcall target="Argil.pear.prepare" />
+ <phingcall target="Argil.pear.package" />
+ <phingcall target="Argil.pear.tar" />
+ </target>
+
+ <target name="Argil.src.prepare" depends="prepare.src, ArgilImpl.src.prepare, ArgilCore.src.prepare">
+ <echo message="Exporting Argil source code..." />
+ <exec command="svn export ${argil.src.argildir} ${argil.build.src.argil}" />
+ </target>
+
+ <target name="Argil.tests.prepare" depends="prepare.tests">
+ <echo message="Preparing Argil unit tests..." />
+ <exec command="svn export ${argil.tests.argil} ${argil.build.tests.argil}" />
+ </target>
+
+ <target name="Argil.tests.run" depends="Argil.tests.prepare, Argil.src.prepare">
+ <echo message="Running Argil unit tests..." />
+ <exec command="phpunit AllTests ${argil.build.tests.basedir}/AllTests.php" checkreturn="true" passthru="true"/>
+ </target>
+
+ <target name="Argil.pear.prepare" depends="Argil.src.prepare">
+ <echo message="Preparing source code for PEAR packaging..." />
+ <copy todir="${argil.build.pear.Argil}">
+ <fileset dir="${argil.build.src.argil}">
+ <include name="**" />
+ </fileset>
+ </copy>
+ </target>
+
+ <target name="Argil.pear.package" depends="Argil.pear.prepare">
+ <echo>Building PEAR package.xml file</echo>
+ <pearpkg name="Argil" dir="${argil.build.pear.Argil}" destFile="${argil.build.pear.basedir}/package.xml">
+ <fileset dir="${argil.build.pear.Argil}">
+ <include name="**/*" />
+ </fileset>
+
+ <option name="notes">Nothing here yet</option>
+ <option name="description">Argil: Better Plumbing</option>
+ <option name="summary">
+ Argil provides a rapid application development framework to get code up and running quickly
+ </option>
+ <option name="version" value="${argil.version}" />
+ <option name="state" value="alpha" />
+ <option name="license" value="LGPL" />
+
+ <mapping name="maintainers">
+ <element>
+ <element key="handle" value="tswicegood" />
+ <element key="name" value="Travis Swicegood" />
+ <element key="email" value="development [at] domain51 [dot] com" />
+ <element key="role" value="lead" />
+ </element>
+ </mapping>
+
+ <mapping name="deps">
+ <element>
+ <element key="type" value="php" />
+ <element key="version" value="5.1.6" />
+ <element key="rel" value="ge" />
+ </element>
+ <element>
+ <element key="type" value="pkg" />
+ <element key="version" value="${argil.version}" />
+ <element key="rel" value="eq" />
+ <element key="name" value="ArgilImpl" />
+ </element>
+ <element>
+ <element key="type" value="pkg" />
+ <element key="version" value="${argil.version}" />
+ <element key="rel" value="eq" />
+ <element key="name" value="ArgilCore" />
+ </element>
+ </mapping>
+ </pearpkg>
+
+ <echo>Converting package.xml 1.0 to package.xml 2.0</echo>
+ <exec command="pear convert ${argil.build.pear.basedir}/package.xml" dir="${argil.build.pear.basedir}" />
+
+ <echo>Replacing old package.xml 1.0 with new</echo>
+ <move file="${argil.build.pear.basedir}/package2.xml" tofile="${argil.build.pear.basedir}/package.xml" overwrite="true" />
+ <delete file="${argil.build.pear.basedir}/package2.xml" />
+
+ </target>
+
+ <target name="Argil.pear.tar" depends="Argil.pear.package">
+ <echo>Creating pear tar.gz file</echo>
+ <delete file="${argil.build.pear.tarfile}" />
+ <tar compression="gzip" destfile="${argil.build.pear.tarfile}" basedir="${argil.build.pear.basedir}" />
+ </target>
+
+</project>
Copied: branches/tswicegood-newmodel/docs/ArgilAjaxApi (from rev 494, trunk/docs/ArgilAjaxApi)
===================================================================
--- branches/tswicegood-newmodel/docs/ArgilAjaxApi (rev 0)
+++ branches/tswicegood-newmodel/docs/ArgilAjaxApi 2007-03-03 20:59:31 UTC (rev 500)
@@ -0,0 +1,5 @@
+Argil Javascript/AJAX API
+=========================
+As I move past version 0.1 and toward 0.2, this page will contain an outline
+of the Javascript API.
+
Deleted: branches/tswicegood-newmodel/docs/CodingStandard
===================================================================
--- trunk/docs/CodingStandard 2007-02-13 19:38:46 UTC (rev 477)
+++ branches/tswicegood-newmodel/docs/CodingStandard 2007-03-03 20:59:31 UTC (rev 500)
@@ -1,43 +0,0 @@
-Pipes Coding Standard
-=====================
-Pipes does not adhere to the *Coding Standard* set forth by PEAR. That
-is actually a [formatting standard][1], which Pipes does have. Our coding
-standard actually focuses on standard level of code:
-
-
-Interface usage
-: There should be no [concrete class dependencies][2]. Type hinting is
- strongly encouraged throughout, however it should hit to an interface,
- not directly to a class.
-
-Method length
-: Methods should be no longer than 10 lines, formatted, and should strive
- to be no longer than 5 lines. If any longer, it becomes hard to determine
- exactly what the method is doing and has a take on more than one role.
-
-Object usage
-: Wherever possible, objects should be passed between each other. The
- objects should implement an interface that is the dependency for a method.
-
-Function/method parameter length
-: A method should have as few parameters as possible. Ideally, none will
- be required as the object will be instantiated with everything that it
- needs. If a method's parameter list goes beyond 3, however, the method has
- started to take on multiple roles. Consider refactoring to a Strategy or
- Facade.
-
-Documentation
-: API documentation, if anywhere, belongs in the interfaces. API docs in
- the code take away from the actual code, often are contradictory to the
- code, and create one additional layer of complexity that must be dealt
- with when any changes to the code are made.
-
-Unit testing
-: All code should be committed with unit tests to verify the committed code.
- Any code without unit tests is considered prototype code and should not be
- depended on for functionality.
-
-
-
-[1]: ./FormattingStandard
-[2]: http://picocontainer.org/Concrete+Class+Dependency
Copied: branches/tswicegood-newmodel/docs/CodingStandard (from rev 494, trunk/docs/CodingStandard)
===================================================================
--- branches/tswicegood-newmodel/docs/CodingStandard (rev 0)
+++ branches/tswicegood-newmodel/docs/CodingStandard 2007-03-03 20:59:31 UTC (rev 500)
@@ -0,0 +1,43 @@
+Argil Coding Standard
+=====================
+Argil does not adhere to the *Coding Standard* set forth by PEAR. That
+is actually a [formatting standard][1], which Argil does have. Our coding
+standard actually focuses on standard level of code:
+
+
+Interface usage
+: There should be no [concrete class dependencies][2]. Type hinting is
+ strongly encouraged throughout, however it should hint to an interface,
+ not directly to a class.
+
+Method length
+: Methods should be no longer than 10 lines, formatted, and should strive
+ to be no longer than 5 lines. If any longer, it becomes hard to determine
+ exactly what the method is doing and has a take on more than one role.
+
+Object usage
+: Wherever possible, objects should be passed between each other. The
+ objects should implement an interface that is the dependency for a method.
+
+Function/method parameter length
+: A method should have as few parameters as possible. Ideally, none will
+ be required as the object will be instantiated with everything that it
+ needs. If a method's parameter list goes beyond 3, however, the method has
+ started to take on multiple roles. Consider refactoring to a Strategy or
+ Facade.
+
+Documentation
+: API documentation, if anywhere, belongs in the interfaces. API docs in
+ the code take away from the actual code, often are contradictory to the
+ code, and create one additional layer of complexity that must be dealt
+ with when any changes to the code are made.
+
+Unit testing
+: All code should be committed with unit tests to verify the committed code.
+ Any code without unit tests is considered prototype code and should not be
+ depended on for functionality.
+
+
+
+[1]: ./FormattingStandard
+[2]: http://picocontainer.org/Concrete+Class+Dependency
Deleted: branches/tswicegood-newmodel/docs/HowTos/BookmarkApp
===================================================================
--- trunk/docs/HowTos/BookmarkApp 2007-02-13 19:38:46 UTC (rev 477)
+++ branches/tswicegood-newmodel/docs/HowTos/BookmarkApp 2007-03-03 20:59:31 UTC (rev 500)
@@ -1,335 +0,0 @@
-How to build a simple bookmark application
-==========================================
-Pipes is a rapid application development framework that provides the tools
-necessary to quickly, and efficiently create database powered applicaitons.
-
-
-Getting Started
----------------
-Make sure you have [installed](../InstallingPipes) Pipes. If this is your
-first application, you will need to start off by creating a *project* for it
-to reside in. To do that, you will need to run the following command:
-
- $ pipes start MyProject
-
-
-### What is a project? ###
-Projects are collections of Models, Views, and Controllers that work together
-to do specific tasks. Projects can contain more than one application. For
-instance, you might have a project powering your site that contains a Blog
-application, a Wiki application, and a Gallery application.
-
-
-A look at what was created
---------------------------
-The `pipes` program just created a skeleton project directory and config
-file. To view the files it just created, look in the new `./MyProject'
-directory. You should see something like this:
-
- MyProject/
- Controllers/
- Models/
- Mappers/
- Metas/
- Savers/
- PageTypes/
- Public/
- Savers/
- Views/
- config.php
-
-You'll recognize many of these directory names as they match up to the standard
-MVC pattern: `Controllers` contains all of the Controller files, `Models`
-contain the the Model files, Views, the View files.
-
-
-Setting up the configuration
-----------------------------
-Pipes has adopted *convention over configuration*, so you won't spend much time
-editing `MyProject/config.php`, but to start with, you'll want to make sure
-your PDO connection is properly set up. Line 10 of the config file will look
-like:
-
- $config['pdo'] = new PDO('mysql:host=localhost;dbname=pipes_demo', 'root', '');
-
-The `pipes_demo` database was assumed based on the project you created. This
-also attempts to connect to the `localhost` using the `root` account with no
-password as that is the default setup for MySQL. It is not a secure means of
-connecting to the database, so it is *strongly* suggested that you change this
-to a user with permissions limited to only the database you want to use.
-
-
-Creating the bookmarks
-----------------------
-The Bookmark app will need a database to store the data it collects in. It can
-contain whatever mix of columns you would like. For the purposes of this
-tutorial, I am assuming you're creating a table with the following
-`CREATE TABLE` code:
-
- CREATE TABLE bookmarks (
- bookmark_id INT(11) NOT NULL,
- title VARCHAR(255) NOT NULL,
- url BLOB NOT NULL,
- description TEXT,
- PRIMARY KEY(bookmark_id)
- )
-
-There are three *conventions* to note here:
-
-1. The name of the table is a simple plural. Pipes assumes all databases will
- be named in a simple plural form - just add *s* to the end of the name.
-2. The primary ID field is the non-plural name of the table with a "_id"
- suffix.
-3. Pipes does not use a built-in sequence, such as MySQL's `auto_increment`.
- Instead, it will create and use a universal `sequences` table to track
- the universal unique ID.
-
-
-Creating the MVC scaffolding
-----------------------------
-Once the data storage has been defined in the database, you need to run the
-`pipes` script again to create the MVC scaffolding. To do so, switch into
-the `MyProject` directory you created earlier and run
-
- $ pipes create Bookmark --with=Tag
-
-This will create the files necessary for a basic CRUD application. Here are
-the files it created:
-
- MyProject/
- Controllers/
- BookmarkController.php
- Models/
- Bookmark.php
- BookmarkList.php
- Mappers/BookmarkMapper.php
- Metas/BookmarkMeta.php
- Views/
- Bookmark/
- add.php
- browse.php
- edit.php
- remove.php
-
-
-You can explore these files on your own. You'll notice that there is not
-much in any of them. Pipes uses *metaprogramming*, or more correctly, a subset
-termed *[CategoryReflection][note-1]*. This basically means that the Pipes is
-capable of looking at where the code exists, what its name is, and figuring out
-what to do from there.
-
-> Future versions of Pipes will also be capable of [Code Generation][note-2] to
-> allow for greater flexibility. While meta-programming allows for quick
-> prototyping, it does create a [tight coupling][note-3] which makes the
-> code less portable.
-
-
-Loading your Bookmark app
--------------------------
-Your application is now ready to load.
-
- http://localhost/pipes/index.php/Bookmark/
-
-That will bring up a page that has 'title', 'url', and 'description', and a
-link to add a new bookmark. Click the *Add New* link to be taken to a form to
-add a new link.
-
-Congratulations! You've just created a basic application that you can browse,
-add, edit, and delete.
-
-
-Creating the interface for Tags
--------------------------------
-One thing your app can't do yet is handle Tags. Though Pipes realizes there is
-a connection there, it doesn't know immediately how to display those related
-items. Since all of the required code is in place, all we have to do is edit
-the view files to make it display properly.
-
-
-Handling tags to Bookmark entries while editing
------------------------------------------------
-Open up the `MyProject/Views/Bookmark/edit.php` in your favorite text editor.
-It should look something like:
-
- <fieldset>
- <legend>Edit Bookmark</legend>
-
- <?php echo $this->form($this->model)->render(); ?>
- </fieldset>
-
-To edit the Tags, we have to add a custom form element. That requires some
-changes to the way the form is automatically generated. Change:
-
- <?php echo $this->form($this->model)->render(); ?>
-
-To:
-
- <?php $form = $this->form($this->model); ?>
- <div pipes:for="tags">
- <label for="form__bookmark__tags">Tags</label>
- <input id="form__bookmark__tags" \
- type="text"
- name="bookmark[tags]"
- value="<?php
- foreach ($this->model->tags as $tag) {
- echo $tag->name . ' ';
- }
- ?>" />
- </div>
- <?php echo $form->render(); ?>
-
-Breaking it down line-by-line, here's what each of these do:
-
- <?php $form = $this->form($this->model); ?>
-
-The `form()` call above calls the PipesCore_Helpers_Form object to work
-as a Helper. Helpers can be in any project and are accessed in Views by
-calling `$this->helperName()`. All this line does is start the generating
-of a Form object.
-
- <div pipes:for="tags">
-
-This line uses an XML Namespace to signify that this should be used by the
-Form object to be displayed whenever a `tags` element is encountered while
-generating the form.
-
- <label for="form__bookmark__tags">Tags</label>
- <input id="form__bookmark__tags" \
- type="text"
- name="bookmark[tags]" ...
-
-All form elements in Pipes contain IDs that are mapped out as
-`form__<model_name>__<column_name>`. All form elements that are to be
-submitted should also have a name in the format of `<model_name>[<column_name>]`
-
- <input id="form__bookmark__tags" \
- type="text"
- name="bookmark[tags]"
- value="<?php
- foreach ($this->model->tags as $tag) {
- echo $tag->name . ' ';
- }
- ?>" />
-
-The `value` of the `input` tag uses a new foreach(). By calling the `tags`
-attribute on the Model, we're asking Pipes to find any related objects. The
-text of a tag's name is in it's `name` attribute, so we're just creating a list
-of space-separated tags as the value.
-
- <?php echo $form->render(); ?>
-
-That's it. Once it's setup, go edit one of the Bookmark entries you created
-earlier, and you'll see a new input called Tags, add a few tags and save.
-When you edit it again, you'll see the newly entered Tags are already in
-the Tags input.
-
-
-Adding custom labels
---------------------
-You'll note that all of the auto-generated labels are just the column names in
-the database. You can easily make these more use friendly by editing the
-`BookmarkMeta` object located at `MyProject/Models/Metas/BookmarkMeta.php`.
-
-Add the following lines to that class:
-
- protected $_columnOverrides = array(
- 'title' => array(
- 'label' => 'Title'
- ),
- 'url' => array(
- 'label' => 'URL'
- ),
- 'description' => array(
- 'label' => 'Description'
- )
- );
-
-Of course, you can make those labels anything you would like. Another thing
-you might have noticed is that the `url` input box is a `textarea`. This is
-because Pipes sees the `BLOB` data type and thinks it should display something
-to accomodate it. Since we want it to act like a normal string, just one with
-a lot of storage, we can set another override in the Meta file and it will
-automatically display as a text input. Change 'url' to look like:
-
- 'url' => array(
- 'label' => 'URL'
- 'type' => 'VARCHAR',
- )
-
-Reload your edit page and you'll see the new text input.
-
-
-Adding tags to the browse page
-------------------------------
-Now that you can add Tags to Bookmark entries, you'll want to be able to see
-them on the browse page. To do this, you'll need to edit the
-`MyProject/PipesDemo/Views/Bookmark/browse.php` file and tell it how to display
-the Tags. In this case, change:
-
- foreach ($this->modelList as $model) {
- $grid->addRow($model);
- }
-
-To:
-
- foreach ($this->modelList as $model) {
- ?>
- <td pipes:for="tags">
- <?php
- foreach ($model->tags as $tag) {
- echo $tag->name . ' ';
- }
- ?>
- </td>
- <?php
- $grid->addRow($model);
- <?php
- }
-
-Again, we're using `pipes:for` to specify that when we get to the `tags`
-element, we already have it determined how we want it to display. This uses
-the same `foreach` that is used in the `edit.php` template to display the tag
-name as a space-separated list. Save the file, and refresh your browse and now
-you'll see tags.
-
-
-Making URLs links
------------------
-One last change to make is to make the URL fields on the browse page links. As
-you might guess, it's just a matter of adding a new `pipes:for` field. In this
-case, before `<td pipes:for="tags">`, add in the following:
-
- <td pipes:for="url">
- <a href="<?php echo $model->url; ?>"><?php echo $model->url; ?></a>
- </td>
-
-What is happening here is pretty straight forward. We're telling the grid to
-display a custom cell that has the `a` tag with the URL in it. Save this file
-and reload the browse page and you'll have links on all of your URLs now.
-
-
-Conclusion and Final Notes
---------------------------
-This tutorial covers basic use of Pipes. It shows you how to create a new
-project, make sure it's configured, and how to edit the view files to create
-some custom displays on the edit and browse pages.
-
-There are a few things missing:
-
-1. First, the tags aren't clickable. As of this release, Pipes does not have
- a tag action in the Controller to handle displaying elements by tags. This
- functionality will be in future releases.
-2. There is now user authentication built-in. This is planned for version 0.2.
- See the [Roadmap](../Roadmap) for more info on future features
-3. You probably noticed several '<column> is required' fields in the forms.
- Those are divs with the class 'required'. They are a placeholder that will
- be used by AJAX form submission validation on later releases.
-3. No discussion was made of PageTypes - the wrappers that wrap all Controller
- content.
-4. CSS files are not automatically cross project loaded.
-
-
-[note-1]: http://c2.com/cgi/wiki?CategoryReflection
-[note-2]: http://en.wikipedia.org/wiki/Source_code_generation
-[note-3]: http://www.toa.com/pub/oobasics/oobasics.htm#ococ
-
Copied: branches/tswicegood-newmodel/docs/HowTos/BookmarkApp (from rev 494, trunk/docs/HowTos/BookmarkApp)
===================================================================
--- branches/tswicegood-newmodel/docs/HowTos/BookmarkApp (rev 0)
+++ branches/tswicegood-newmodel/docs/HowTos/BookmarkApp 2007-03-03 20:59:31 UTC (rev 500)
@@ -0,0 +1,335 @@
+How to build a simple bookmark application
+==========================================
+Argil is a rapid application development framework that provides the tools
+necessary to quickly, and efficiently create database powered applicaitons.
+
+
+Getting Started
+---------------
+Make sure you have [installed](../InstallingArgil) Argil. If this is your
+first application, you will need to start off by creating a *project* for it
+to reside in. To do that, you will need to run the following command:
+
+ $ argil start MyProject
+
+
+### What is a project? ###
+Projects are collections of Models, Views, and Controllers that work together
+to do specific tasks. Projects can contain more than one application. For
+instance, you might have a project powering your site that contains a Blog
+application, a Wiki application, and a Gallery application.
+
+
+A look at what was created
+--------------------------
+The `argil` program just created a skeleton project directory and config
+file. To view the files it just created, look in the new `./MyProject'
+directory. You should see something like this:
+
+ MyProject/
+ Controllers/
+ Models/
+ Mappers/
+ Metas/
+ Savers/
+ PageTypes/
+ Public/
+ Savers/
+ Views/
+ config.php
+
+You'll recognize many of these directory names as they match up to the standard
+MVC pattern: `Controllers` contains all of the Controller files, `Models`
+contain the the Model files, Views, the View files.
+
+
+Setting up the configuration
+----------------------------
+Argil has adopted *convention over configuration*, so you won't spend much time
+editing `MyProject/config.php`, but to start with, you'll want to make sure
+your PDO connection is properly set up. Line 10 of the config file will look
+like:
+
+ $config['pdo'] = new PDO('mysql:host=localhost;dbname=argil_demo', 'root', '');
+
+The `argil_demo` database was assumed based on the project you created. This
+also attempts to connect to the `localhost` using the `root` account with no
+password as that is the default setup for MySQL. It is not a secure means of
+connecting to the database, so it is *strongly* suggested that you change this
+to a user with permissions limited to only the database you want to use.
+
+
+Creating the bookmarks
+----------------------
+The Bookmark app will need a database to store the data it collects in. It can
+contain whatever mix of columns you would like. For the purposes of this
+tutorial, I am assuming you're creating a table with the following
+`CREATE TABLE` code:
+
+ CREATE TABLE bookmarks (
+ bookmark_id INT(11) NOT NULL,
+ title VARCHAR(255) NOT NULL,
+ url BLOB NOT NULL,
+ description TEXT,
+ PRIMARY KEY(bookmark_id)
+ )
+
+There are three *conventions* to note here:
+
+1. The name of the table is a simple plural. Argil assumes all databases will
+ be named in a simple plural form - just add *s* to the end of the name.
+2. The primary ID field is the non-plural name of the table with a "_id"
+ suffix.
+3. Argil does not use a built-in sequence, such as MySQL's `auto_increment`.
+ Instead, it will create and use a universal `sequences` table to track
+ the universal unique ID.
+
+
+Creating the MVC scaffolding
+----------------------------
+Once the data storage has been defined in the database, you need to run the
+`argil` script again to create the MVC scaffolding. To do so, switch into
+the `MyProject` directory you created earlier and run
+
+ $ argil create Bookmark --with=Tag
+
+This will create the files necessary for a basic CRUD application. Here are
+the files it created:
+
+ MyProject/
+ Controllers/
+ BookmarkController.php
+ Models/
+ Bookmark.php
+ BookmarkList.php
+ Mappers/BookmarkMapper.php
+ Metas/BookmarkMeta.php
+ Views/
+ Bookmark/
+ add.php
+ browse.php
+ edit.php
+ remove.php
+
+
+You can explore these files on your own. You'll notice that there is not
+much in any of them. Argil uses *metaprogramming*, or more correctly, a subset
+termed *[CategoryReflection][note-1]*. This basically means that the Argil is
+capable of looking at where the code exists, what its name is, and figuring out
+what to do from there.
+
+> Future versions of Argil will also be capable of [Code Generation][note-2] to
+> allow for greater flexibility. While meta-programming allows for quick
+> prototyping, it does create a [tight coupling][note-3] which makes the
+> code less portable.
+
+
+Loading your Bookmark app
+-------------------------
+Your application is now ready to load.
+
+ http://localhost/argil/index.php/Bookmark/
+
+That will bring up a page that has 'title', 'url', and 'description', and a
+link to add a new bookmark. Click the *Add New* link to be taken to a form to
+add a new link.
+
+Congratulations! You've just created a basic application that you can browse,
+add, edit, and delete.
+
+
+Creating the interface for Tags
+-------------------------------
+One thing your app can't do yet is handle Tags. Though Argil realizes there is
+a connection there, it doesn't know immediately how to display those related
+items. Since all of the required code is in place, all we have to do is edit
+the view files to make it display properly.
+
+
+Handling tags to Bookmark entries while editing
+-----------------------------------------------
+Open up the `MyProject/Views/Bookmark/edit.php` in your favorite text editor.
+It should look something like:
+
+ <fieldset>
+ <legend>Edit Bookmark</legend>
+
+ <?php echo $this->form($this->model)->render(); ?>
+ </fieldset>
+
+To edit the Tags, we have to add a custom form element. That requires some
+changes to the way the form is automatically generated. Change:
+
+ <?php echo $this->form($this->model)->render(); ?>
+
+To:
+
+ <?php $form = $this->form($this->model); ?>
+ <div argil:for="tags">
+ <label for="form__bookmark__tags">Tags</label>
+ <input id="form__bookmark__tags" \
+ type="text"
+ name="bookmark[tags]"
+ value="<?php
+ foreach ($this->model->tags as $tag) {
+ echo $tag->name . ' ';
+ }
+ ?>" />
+ </div>
+ <?php echo $form->render(); ?>
+
+Breaking it down line-by-line, here's what each of these do:
+
+ <?php $form = $this->form($this->model); ?>
+
+The `form()` call above calls the ArgilCore_Helpers_Form object to work
+as a Helper. Helpers can be in any project and are accessed in Views by
+calling `$this->helperName()`. All this line does is start the generating
+of a Form object.
+
+ <div argil:for="tags">
+
+This line uses an XML Namespace to signify that this should be used by the
+Form object to be displayed whenever a `tags` element is encountered while
+generating the form.
+
+ <label for="form__bookmark__tags">Tags</label>
+ <input id="form__bookmark__tags" \
+ type="text"
+ name="bookmark[tags]" ...
+
+All form elements in Argil contain IDs that are mapped out as
+`form__<model_name>__<column_name>`. All form elements that are to be
+submitted should also have a name in the format of `<model_name>[<column_name>]`
+
+ <input id="form__bookmark__tags" \
+ type="text"
+ name="bookmark[tags]"
+ value="<?php
+ foreach ($this->model->tags as $tag) {
+ echo $tag->name . ' ';
+ }
+ ?>" />
+
+The `value` of the `input` tag uses a new foreach(). By calling the `tags`
+attribute on the Model, we're asking Argil to find any related objects. The
+text of a tag's name is in it's `name` attribute, so we're just creating a list
+of space-separated tags as the value.
+
+ <?php echo $form->render(); ?>
+
+That's it. Once it's setup, go edit one of the Bookmark entries you created
+earlier, and you'll see a new input called Tags, add a few tags and save.
+When you edit it again, you'll see the newly entered Tags are already in
+the Tags input.
+
+
+Adding custom labels
+--------------------
+You'll note that all of the auto-generated labels are just the column names in
+the database. You can easily make these more use friendly by editing the
+`BookmarkMeta` object located at `MyProject/Models/Metas/BookmarkMeta.php`.
+
+Add the following lines to that class:
+
+ protected $_columnOverrides = array(
+ 'title' => array(
+ 'label' => 'Title'
+ ),
+ 'url' => array(
+ 'label' => 'URL'
+ ),
+ 'description' => array(
+ 'label' => 'Description'
+ )
+ );
+
+Of course, you can make those labels anything you would like. Another thing
+you might have noticed is that the `url` input box is a `textarea`. This is
+because Argil sees the `BLOB` data type and thinks it should display something
+to accomodate it. Since we want it to act like a normal string, just one with
+a lot of storage, we can set another override in the Meta file and it will
+automatically display as a text input. Change 'url' to look like:
+
+ 'url' => array(
+ 'label' => 'URL'
+ 'type' => 'VARCHAR',
+ )
+
+Reload your edit page and you'll see the new text input.
+
+
+Adding tags to the browse page
+------------------------------
+Now that you can add Tags to Bookmark entries, you'll want to be able to see
+them on the browse page. To do this, you'll need to edit the
+`MyProject/ArgilDemo/Views/Bookmark/browse.php` file and tell it how to display
+the Tags. In this case, change:
+
+ foreach ($this->modelList as $model) {
+ $grid->addRow($model);
+ }
+
+To:
+
+ foreach ($this->modelList as $model) {
+ ?>
+ <td argil:for="tags">
+ <?php
+ foreach ($model->tags as $tag) {
+ echo $tag->name . ' ';
+ }
+ ?>
+ </td>
+ <?php
+ $grid->addRow($model);
+ <?php
+ }
+
+Again, we're using `argil:for` to specify that when we get to the `tags`
+element, we already have it determined how we want it to display. This uses
+the same `foreach` that is used in the `edit.php` template to display the tag
+name as a space-separated list. Save the file, and refresh your browse and now
+you'll see tags.
+
+
+Making URLs links
+-----------------
+One last change to make is to make the URL fields on the browse page links. As
+you might guess, it's just a matter of adding a new `argil:for` field. In this
+case, before `<td argil:for="tags">`, add in the following:
+
+ <td argil:for="url">
+ <a href="<?php echo $model->url; ?>"><?php echo $model->url; ?></a>
+ </td>
+
+What is happening here is pretty straight forward. We're telling the grid to
+display a custom cell that has the `a` tag with the URL in it. Save this file
+and reload the browse page and you'll have links on all of your URLs now.
+
+
+Conclusion and Final Notes
+--------------------------
+This tutorial covers basic use of Argil. It shows you how to create a new
+project, make sure it's configured, and how to edit the view files to create
+some custom displays on the edit and browse pages.
+
+There are a few things missing:
+
+1. First, the tags aren't clickable. As of this release, Argil does not have
+ a tag action in the Controller to handle displaying elements by tags. This
+ functionality will be in future releases.
+2. There is now user authentication built-in. This is planned for version 0.2.
+ See the [Roadmap](../Roadmap) for more info on future features
+3. You probably noticed several '<column> is required' fields in the forms.
+ Those are divs with the class 'required'. They are a placeholder that will
+ be used by AJAX form submission validation on later releases.
+3. No discussion was made of PageTypes - the wrappers that wrap all Controller
+ content.
+4. CSS files are not automatically cross project loaded.
+
+
+[note-1]: http://c2.com/cgi/wiki?CategoryReflection
+[note-2]: http://en.wikipedia.org/wiki/Source_code_generation
+[note-3]: http://www.toa.com/pub/oobasics/oobasics.htm#ococ
+
Deleted: branches/tswicegood-newmodel/docs/HowTos/HelloWorld
===================================================================
--- trunk/doc...
[truncated message content] |
|
From: <tsw...@us...> - 2007-02-22 15:33:21
|
Revision: 499
http://argil.svn.sourceforge.net/argil/?rev=499&view=rev
Author: tswicegood
Date: 2007-02-22 07:33:21 -0800 (Thu, 22 Feb 2007)
Log Message:
-----------
Add more descriptive titles
Modified Paths:
--------------
trunk/docs/Manifesto
trunk/docs/Roadmap
Modified: trunk/docs/Manifesto
===================================================================
--- trunk/docs/Manifesto 2007-02-22 15:32:13 UTC (rev 498)
+++ trunk/docs/Manifesto 2007-02-22 15:33:21 UTC (rev 499)
@@ -1,5 +1,5 @@
-Argil Framework
-===============
+Argil Framework Manifesto
+=========================
There are no PHP 5 MVC frameworks that do the work for you. The best code is
self generating - that's what Argil is all about. By creating a simple MVC
framework and command line tool to go along with it, Argil automates the grunt
Modified: trunk/docs/Roadmap
===================================================================
--- trunk/docs/Roadmap 2007-02-22 15:32:13 UTC (rev 498)
+++ trunk/docs/Roadmap 2007-02-22 15:33:21 UTC (rev 499)
@@ -1,5 +1,5 @@
-Argil Framework
-===============
+Argil Framework Roadmap
+=======================
Argil is an OO MVC framework built in PHP 5 designed to quickly and easily build
a MVC application around database tables created using your favorite MySQL
client. This document outlines the intended features through version 1.0 with
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|