diff options
author | wei <> | 2006-07-14 06:56:16 +0000 |
---|---|---|
committer | wei <> | 2006-07-14 06:56:16 +0000 |
commit | 143980b6dab8ad87c44518e5b7befb614fb83b85 (patch) | |
tree | 6afadfb80ca6e4d36443f83bd5a6cc2cfe73032d /demos/time-tracker/tests/unit/AddUserToProjectTestCase.php | |
parent | c004bbdf4f0e824e5ccbaef8f98ca4a3d44d3b49 (diff) |
Add time-tracker sample and docs. (Incomplete)
Diffstat (limited to 'demos/time-tracker/tests/unit/AddUserToProjectTestCase.php')
-rw-r--r-- | demos/time-tracker/tests/unit/AddUserToProjectTestCase.php | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/demos/time-tracker/tests/unit/AddUserToProjectTestCase.php b/demos/time-tracker/tests/unit/AddUserToProjectTestCase.php new file mode 100644 index 00000000..36defc57 --- /dev/null +++ b/demos/time-tracker/tests/unit/AddUserToProjectTestCase.php @@ -0,0 +1,35 @@ +<?php
+
+require_once(dirname(__FILE__).'/ProjectDaoTestCase.php');
+
+class AddUserToProjectTestCase extends ProjectDaoTestCase
+{
+ function testCanAddNewUserToProject()
+ {
+ $project = $this->createNewTestProject();
+
+ $user = new TimeTrackerUser();
+ $user->ID = 3;
+ $user->Name = "test user 1";
+
+ if(($conn = $this->connection) instanceof MockTSqlMapper)
+ {
+ $this->setupMockConnectionFor($project);
+ $conn->setReturnReference('queryForObject', $user, array('GetUserByName', $user->Name));
+ $conn->setReturnValue('queryForList', array(), array('GetProjectMembers', $project));
+
+ $param['project'] = $project;
+ $param['user'] = $user;
+
+ $conn->setReturnValue('insert', true, array('AddNewUserToProject', $param));
+
+ $conn->expectAtLeastOnce('insert');
+ $conn->expectAtLeastOnce('queryForList');
+ }
+
+ $this->assertTrue($this->dao->createNewProject($project));
+ $this->assertTrue($this->dao->addUserToProject($project, $user));
+ }
+}
+
+?>
\ No newline at end of file |