当前位置: 首页>>代码示例>>PHP>>正文


PHP Task::getByName方法代码示例

本文整理汇总了PHP中Task::getByName方法的典型用法代码示例。如果您正苦于以下问题:PHP Task::getByName方法的具体用法?PHP Task::getByName怎么用?PHP Task::getByName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Task的用法示例。


在下文中一共展示了Task::getByName方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testGetMaximumSortOrderByType

 public function testGetMaximumSortOrderByType()
 {
     $tasks = Task::getByName('MyTask');
     $task = $tasks[0];
     $kanbanItem = KanbanItem::getByTask($task->id);
     $sortOrder = KanbanItem::getMaximumSortOrderByType($kanbanItem->type, $task->activityItems->offsetGet(0));
     $this->assertEquals(2, $sortOrder);
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:8,代码来源:KanbanItemTest.php

示例2: testAjaxCheckItemListForRelatedTaskModel

 public function testAjaxCheckItemListForRelatedTaskModel()
 {
     $super = $this->logoutCurrentUserLoginNewUserAndGetByUsername('super');
     $tasks = Task::getByName('aTest');
     $task = $tasks[0];
     $taskCheckListItem = new TaskCheckListItem();
     $taskCheckListItem->name = 'Test Check List Item1';
     $taskCheckListItem->completed = true;
     $task->checkListItems->add($taskCheckListItem);
     $saved = $task->save();
     $this->assertTrue($saved);
     $this->setGetArray(array('relatedModelId' => $task->id, 'relatedModelClassName' => 'Task', 'relatedModelRelationName' => 'checkListItems', 'uniquePageId' => 'TaskCheckItemInlineEditForModelView'));
     $content = $this->runControllerWithNoExceptionsAndGetContent('tasks/taskCheckItems/ajaxCheckItemListForRelatedTaskModel');
     $this->assertContains('Test Check List Item1', $content);
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:15,代码来源:TaskCheckItemsAjaxSuperUserWalkthroughTest.php

示例3: testDeleteOfTheTaskForTheCustomFieldsPlacedForTasksModule

 /**
  * @depends testEditOfTheTaskForTheCustomFieldsPlacedForTasksModule
  */
 public function testDeleteOfTheTaskForTheCustomFieldsPlacedForTasksModule()
 {
     $super = $this->logoutCurrentUserLoginNewUserAndGetByUsername('super');
     //Retrieve the task Id.
     $task = Task::getByName('myEditTask');
     //Set the task id so as to delete the task.
     $this->setGetArray(array('id' => $task[0]->id));
     $this->runControllerWithRedirectExceptionAndGetUrl('tasks/default/delete');
     //Check to confirm that the task is deleted.
     $task = Task::getByName('myEditTask');
     $this->assertEquals(0, count($task));
 }
开发者ID:sandeep1027,项目名称:zurmo_,代码行数:15,代码来源:TasksDesignerSuperUserWalkthroughTest.php

示例4: testUpdateStatusViaAjax

 /**
  * @depends testSaveChecklistItemForTaskUsingAjax
  */
 public function testUpdateStatusViaAjax()
 {
     $super = $this->logoutCurrentUserLoginNewUserAndGetByUsername('super');
     $tasks = Task::getByName('aTest');
     $task = $tasks[0];
     $taskId = $task->id;
     $checkListItems = $task->checkListItems;
     $this->setGetArray(array('id' => $checkListItems[0]->id, 'taskId' => $taskId, 'checkListItemCompleted' => '1'));
     $content = $this->runControllerWithNoExceptionsAndGetContent('tasks/taskCheckItems/updateStatusViaAjax', true);
     $taskCheckListItem = TaskCheckListItem::getById(intval($checkListItems[0]->id));
     $this->assertTrue((bool) $taskCheckListItem->completed);
     $this->setGetArray(array('id' => $checkListItems[0]->id, 'taskId' => $taskId, 'checkListItemCompleted' => '0'));
     $content = $this->runControllerWithNoExceptionsAndGetContent('tasks/taskCheckItems/updateStatusViaAjax', true);
     $taskCheckListItem = TaskCheckListItem::getById(intval($checkListItems[0]->id));
     $this->assertFalse((bool) $taskCheckListItem->completed);
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:19,代码来源:TaskCheckItemsSuperUserWalkthroughTest.php

示例5: testSuperUserCopyAction

 public function testSuperUserCopyAction()
 {
     $super = $this->logoutCurrentUserLoginNewUserAndGetByUsername('super');
     $superAccountId = self::getModelIdByModelNameAndName('Account', 'superAccount');
     $superContactId = self::getModelIdByModelNameAndName('Contact', 'superContact superContactson');
     $account = Account::getById($superAccountId);
     $contact = Contact::getById($superContactId);
     $activityItemPostData = array('Account' => array('id' => $superAccountId), 'Contact' => array('id' => $superContactId));
     $this->setGetArray(array('relationAttributeName' => 'Account', 'relationModelId' => $superAccountId, 'relationModuleId' => 'accounts', 'redirectUrl' => 'someRedirect'));
     $this->setPostArray(array('ActivityItemForm' => $activityItemPostData, 'Task' => array('name' => 'myTask', 'description' => 'Some task description')));
     $this->runControllerWithRedirectExceptionAndGetContent('tasks/default/createFromRelation');
     $tasks = Task::getByName('myTask');
     $this->assertCount(1, $tasks);
     $this->setGetArray(array('id' => $tasks[0]->id));
     $this->resetPostArray();
     $content = $this->runControllerWithNoExceptionsAndGetContent('tasks/default/copy');
     $this->assertContains($tasks[0]->name, $content);
     $this->assertContains($tasks[0]->description, $content);
     $this->assertContains($account->name, $content);
     $this->assertContains($contact->getFullName(), $content);
     $taskCopy = new Task();
     ActivityCopyModelUtil::copy($tasks[0], $taskCopy);
     $activityItemPostData = array();
     foreach ($taskCopy->activityItems as $relatedModel) {
         $activityItemPostData[get_class($relatedModel)] = array('id' => $relatedModel->id);
     }
     $postArray = array('Task' => array('name' => $taskCopy->name, 'description' => $taskCopy->description), 'ActivityItemForm' => $activityItemPostData);
     $this->setPostArray($postArray);
     $this->setGetArray(array('id' => $tasks[0]->id));
     $content = $this->runControllerWithRedirectExceptionAndGetContent('tasks/default/copy');
     $tasks = Task::getByName('myTask');
     $this->assertCount(2, $tasks);
     $this->assertEquals($tasks[0]->name, $tasks[1]->name);
     $this->assertEquals($tasks[0]->description, $tasks[1]->description);
     $this->assertEquals($tasks[0]->activityItems[0], $tasks[1]->activityItems[0]);
     $this->assertEquals($tasks[0]->activityItems[1], $tasks[1]->activityItems[1]);
     $tasks[0]->delete();
     $tasks[1]->delete();
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:39,代码来源:TasksSuperUserWalkthroughTest.php

示例6: testUnprivilegedUserViewUpdateDeleteTasks

 /**
  * @depends testListTasks
  */
 public function testUnprivilegedUserViewUpdateDeleteTasks()
 {
     Yii::app()->user->userModel = User::getByUsername('super');
     $notAllowedUser = UserTestHelper::createBasicUser('Steven');
     $notAllowedUser->setRight('UsersModule', UsersModule::RIGHT_LOGIN_VIA_WEB_API);
     $saved = $notAllowedUser->save();
     $authenticationData = $this->login('steven', 'steven');
     $headers = array('Accept: application/json', 'ZURMO_SESSION_ID: ' . $authenticationData['sessionId'], 'ZURMO_TOKEN: ' . $authenticationData['token'], 'ZURMO_API_REQUEST_TYPE: REST');
     $everyoneGroup = Group::getByName(Group::EVERYONE_GROUP_NAME);
     $this->assertTrue($everyoneGroup->save());
     $tasks = Task::getByName('Check bills');
     $this->assertEquals(1, count($tasks));
     $data['completed'] = 1;
     // Test with unprivileged user to view, edit and delete account.
     $authenticationData = $this->login('steven', 'steven');
     $headers = array('Accept: application/json', 'ZURMO_SESSION_ID: ' . $authenticationData['sessionId'], 'ZURMO_TOKEN: ' . $authenticationData['token'], 'ZURMO_API_REQUEST_TYPE: REST');
     $response = ApiRestTestHelper::createApiCall($this->serverUrl . '/test.php/tasks/task/api/read/' . $tasks[0]->id, 'GET', $headers);
     $response = json_decode($response, true);
     $this->assertEquals(ApiResponse::STATUS_FAILURE, $response['status']);
     $this->assertEquals('You do not have rights to perform this action.', $response['message']);
     $response = ApiRestTestHelper::createApiCall($this->serverUrl . '/test.php/tasks/task/api/read/' . $tasks[0]->id, 'PUT', $headers, array('data' => $data));
     $response = json_decode($response, true);
     $this->assertEquals(ApiResponse::STATUS_FAILURE, $response['status']);
     $this->assertEquals('You do not have rights to perform this action.', $response['message']);
     $response = ApiRestTestHelper::createApiCall($this->serverUrl . '/test.php/tasks/task/api/read/' . $tasks[0]->id, 'DELETE', $headers);
     $response = json_decode($response, true);
     $this->assertEquals(ApiResponse::STATUS_FAILURE, $response['status']);
     $this->assertEquals('You do not have rights to perform this action.', $response['message']);
     //now check if user have rights, but no permissions.
     $notAllowedUser->setRight('TasksModule', TasksModule::getAccessRight());
     $notAllowedUser->setRight('TasksModule', TasksModule::getCreateRight());
     $notAllowedUser->setRight('TasksModule', TasksModule::getDeleteRight());
     $saved = $notAllowedUser->save();
     $this->assertTrue($saved);
     $response = ApiRestTestHelper::createApiCall($this->serverUrl . '/test.php/tasks/task/api/read/' . $tasks[0]->id, 'GET', $headers);
     $response = json_decode($response, true);
     $this->assertEquals(ApiResponse::STATUS_FAILURE, $response['status']);
     $this->assertEquals('You do not have permissions for this action.', $response['message']);
     $response = ApiRestTestHelper::createApiCall($this->serverUrl . '/test.php/tasks/task/api/update/' . $tasks[0]->id, 'PUT', $headers, array('data' => $data));
     $response = json_decode($response, true);
     $this->assertEquals(ApiResponse::STATUS_FAILURE, $response['status']);
     $this->assertEquals('You do not have permissions for this action.', $response['message']);
     $response = ApiRestTestHelper::createApiCall($this->serverUrl . '/test.php/tasks/task/api/delete/' . $tasks[0]->id, 'DELETE', $headers);
     $response = json_decode($response, true);
     $this->assertEquals(ApiResponse::STATUS_FAILURE, $response['status']);
     $this->assertEquals('You do not have permissions for this action.', $response['message']);
     // Allow everyone group to read/write task
     $authenticationData = $this->login();
     $headers = array('Accept: application/json', 'ZURMO_SESSION_ID: ' . $authenticationData['sessionId'], 'ZURMO_TOKEN: ' . $authenticationData['token'], 'ZURMO_API_REQUEST_TYPE: REST');
     unset($data);
     $data['explicitReadWriteModelPermissions'] = array('type' => ExplicitReadWriteModelPermissionsUtil::MIXED_TYPE_EVERYONE_GROUP);
     $response = ApiRestTestHelper::createApiCall($this->serverUrl . '/test.php/tasks/task/api/update/' . $tasks[0]->id, 'PUT', $headers, array('data' => $data));
     $response = json_decode($response, true);
     $this->assertEquals(ApiResponse::STATUS_SUCCESS, $response['status']);
     $authenticationData = $this->login('steven', 'steven');
     $headers = array('Accept: application/json', 'ZURMO_SESSION_ID: ' . $authenticationData['sessionId'], 'ZURMO_TOKEN: ' . $authenticationData['token'], 'ZURMO_API_REQUEST_TYPE: REST');
     $response = ApiRestTestHelper::createApiCall($this->serverUrl . '/test.php/tasks/task/api/read/' . $tasks[0]->id, 'GET', $headers);
     $response = json_decode($response, true);
     $this->assertEquals(ApiResponse::STATUS_SUCCESS, $response['status']);
     unset($data);
     $data['completed'] = 1;
     $response = ApiRestTestHelper::createApiCall($this->serverUrl . '/test.php/tasks/task/api/update/' . $tasks[0]->id, 'PUT', $headers, array('data' => $data));
     $response = json_decode($response, true);
     $this->assertEquals(ApiResponse::STATUS_SUCCESS, $response['status']);
     $this->assertEquals(1, $response['data']['completed']);
     $response = ApiRestTestHelper::createApiCall($this->serverUrl . '/test.php/tasks/task/api/delete/' . $tasks[0]->id, 'DELETE', $headers);
     $response = json_decode($response, true);
     $this->assertEquals(ApiResponse::STATUS_FAILURE, $response['status']);
     $this->assertEquals('You do not have permissions for this action.', $response['message']);
     // Test with privileged user
     $authenticationData = $this->login();
     $headers = array('Accept: application/json', 'ZURMO_SESSION_ID: ' . $authenticationData['sessionId'], 'ZURMO_TOKEN: ' . $authenticationData['token'], 'ZURMO_API_REQUEST_TYPE: REST');
     //Test Delete
     $response = ApiRestTestHelper::createApiCall($this->serverUrl . '/test.php/tasks/task/api/delete/' . $tasks[0]->id, 'DELETE', $headers);
     $response = json_decode($response, true);
     $this->assertEquals(ApiResponse::STATUS_SUCCESS, $response['status']);
     $response = ApiRestTestHelper::createApiCall($this->serverUrl . '/test.php/tasks/task/api/read/' . $tasks[0]->id, 'GET', $headers);
     $response = json_decode($response, true);
     $this->assertEquals(ApiResponse::STATUS_FAILURE, $response['status']);
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:83,代码来源:ApiRestTaskTest.php

示例7: testDoNotificationSubscribersContainPerson

 /**
  * @covers doNotificationSubscribersContainPerson
  */
 public function testDoNotificationSubscribersContainPerson()
 {
     Yii::app()->user->userModel = User::getByUsername('super');
     $tasks = Task::getByName('MyTest');
     $isContained = $tasks[0]->doNotificationSubscribersContainPerson(Yii::app()->user->userModel);
     $this->assertTrue($isContained);
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:10,代码来源:TaskTest.php

示例8: testProcessKanbanItemUpdateWithSourceKanbanTypeAsInProgress

 /**
  * @covers processKanbanItemUpdateOnButtonAction
  */
 public function testProcessKanbanItemUpdateWithSourceKanbanTypeAsInProgress()
 {
     $tasks = Task::getByName('MyFirstKanbanTask');
     $task = $tasks[0];
     $tasks = Task::getByName('MySecondKanbanTask');
     $task2 = $tasks[0];
     $tasks = Task::getByName('MyThirdKanbanTask');
     $task3 = $tasks[0];
     $kanbanItem2 = KanbanItem::getByTask($task2->id);
     $task2->setScenario('kanbanViewButtonClick');
     //Check for target status waiting for acceptance(should not change sort order)
     TasksUtil::processKanbanItemUpdateOnButtonAction(Task::STATUS_AWAITING_ACCEPTANCE, $task2->id, $kanbanItem2->type);
     $kanbanItem = KanbanItem::getByTask($task->id);
     $kanbanItem2 = KanbanItem::getByTask($task2->id);
     $kanbanItem3 = KanbanItem::getByTask($task3->id);
     $this->assertEquals($task->id, $kanbanItem->task->id);
     $this->assertEquals(3, $kanbanItem->sortOrder);
     $this->assertEquals($task2->id, $kanbanItem2->task->id);
     $this->assertEquals(1, $kanbanItem2->sortOrder);
     $this->assertEquals($task3->id, $kanbanItem3->task->id);
     $this->assertEquals(2, $kanbanItem3->sortOrder);
     $task2->setScenario('kanbanViewButtonClick');
     //Check for target status rejected(should not change sort order)
     TasksUtil::processKanbanItemUpdateOnButtonAction(Task::STATUS_REJECTED, $task2->id, $kanbanItem2->type);
     $kanbanItem = KanbanItem::getByTask($task->id);
     $kanbanItem2 = KanbanItem::getByTask($task2->id);
     $kanbanItem3 = KanbanItem::getByTask($task3->id);
     $this->assertEquals($task->id, $kanbanItem->task->id);
     $this->assertEquals(3, $kanbanItem->sortOrder);
     $this->assertEquals($task2->id, $kanbanItem2->task->id);
     $this->assertEquals(1, $kanbanItem2->sortOrder);
     $this->assertEquals($task3->id, $kanbanItem3->task->id);
     $this->assertEquals(2, $kanbanItem3->sortOrder);
     $task2->setScenario('kanbanViewButtonClick');
     //Check for target status in progress(should not change sort order)
     TasksUtil::processKanbanItemUpdateOnButtonAction(Task::STATUS_IN_PROGRESS, $task2->id, $kanbanItem2->type);
     $kanbanItem = KanbanItem::getByTask($task->id);
     $kanbanItem2 = KanbanItem::getByTask($task2->id);
     $kanbanItem3 = KanbanItem::getByTask($task3->id);
     $this->assertEquals($task->id, $kanbanItem->task->id);
     $this->assertEquals(3, $kanbanItem->sortOrder);
     $this->assertEquals($task2->id, $kanbanItem2->task->id);
     $this->assertEquals(1, $kanbanItem2->sortOrder);
     $this->assertEquals($task3->id, $kanbanItem3->task->id);
     $this->assertEquals(2, $kanbanItem3->sortOrder);
     $task2->setScenario('kanbanViewButtonClick');
     //Check for target status completed(should change sort order)
     TasksUtil::processKanbanItemUpdateOnButtonAction(Task::STATUS_COMPLETED, $task2->id, $kanbanItem2->type);
     $kanbanItem = KanbanItem::getByTask($task->id);
     $kanbanItem2 = KanbanItem::getByTask($task2->id);
     $kanbanItem3 = KanbanItem::getByTask($task3->id);
     $this->assertEquals($task->id, $kanbanItem->task->id);
     $this->assertEquals(2, $kanbanItem->sortOrder);
     $this->assertEquals($task2->id, $kanbanItem2->task->id);
     $this->assertEquals(KanbanItem::TYPE_COMPLETED, $kanbanItem2->type);
     $this->assertEquals(1, $kanbanItem2->sortOrder);
     $this->assertEquals($task3->id, $kanbanItem3->task->id);
     $this->assertEquals(1, $kanbanItem3->sortOrder);
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:62,代码来源:TasksUtilTest.php

示例9: testUpdateStatusInKanbanView

 /**
  * @depends testUpdateStatusOnDragInKanbanView
  */
 public function testUpdateStatusInKanbanView()
 {
     $super = $this->logoutCurrentUserLoginNewUserAndGetByUsername('super');
     $tasks = Task::getByName('My Kanban Task');
     $task = $tasks[0];
     $taskId = $task->id;
     $this->setGetArray(array('targetStatus' => Task::STATUS_AWAITING_ACCEPTANCE, 'taskId' => $task->id, 'sourceKanbanType' => KanbanItem::TYPE_IN_PROGRESS));
     $this->runControllerWithNoExceptionsAndGetContent('tasks/default/updateStatusInKanbanView', false);
     $task = Task::getById($taskId);
     $this->assertEquals(Task::STATUS_AWAITING_ACCEPTANCE, $task->status);
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:14,代码来源:TaskAjaxSuperUserWalkthroughTest.php

示例10: testSimpleUserImportWhereAllRowsSucceed

 public function testSimpleUserImportWhereAllRowsSucceed()
 {
     Yii::app()->user->userModel = User::getByUsername('super');
     $tasks = Task::getAll();
     $this->assertEquals(0, count($tasks));
     $import = new Import();
     $serializedData['importRulesType'] = 'Tasks';
     $serializedData['firstRowIsHeaderRow'] = true;
     $import->serializedData = serialize($serializedData);
     $this->assertTrue($import->save());
     ImportTestHelper::createTempTableByFileNameAndTableName('simpleImportTest.csv', $import->getTempTableName(), true, Yii::getPathOfAlias('application.modules.tasks.tests.unit.files'));
     $this->assertEquals(4, ImportDatabaseUtil::getCount($import->getTempTableName()));
     // includes header rows.
     $mappingData = array('column_0' => ImportMappingUtil::makeStringColumnMappingData('name'), 'column_1' => ImportMappingUtil::makeDateTimeColumnMappingData('dueDateTime'), 'column_2' => ImportMappingUtil::makeDateTimeColumnMappingData('completedDateTime'), 'column_3' => ImportMappingUtil::makeIntegerColumnMappingData('status'), 'column_4' => ImportMappingUtil::makeModelDerivedColumnMappingData('AccountDerived'), 'column_5' => ImportMappingUtil::makeModelDerivedColumnMappingData('ContactDerived'), 'column_6' => ImportMappingUtil::makeModelDerivedColumnMappingData('OpportunityDerived'), 'column_7' => ImportMappingUtil::makeTextAreaColumnMappingData('description'));
     $importRules = ImportRulesUtil::makeImportRulesByType('Tasks');
     $page = 0;
     $config = array('pagination' => array('pageSize' => 50));
     //This way all rows are processed.
     $dataProvider = new ImportDataProvider($import->getTempTableName(), true, $config);
     $dataProvider->getPagination()->setCurrentPage($page);
     $importResultsUtil = new ImportResultsUtil($import);
     $actionDateTime = substr(DateTimeUtil::convertTimestampToDbFormatDateTime(time()), 0, -3);
     $messageLogger = new ImportMessageLogger();
     ImportUtil::importByDataProvider($dataProvider, $importRules, $mappingData, $importResultsUtil, new ExplicitReadWriteModelPermissions(), $messageLogger);
     $importResultsUtil->processStatusAndMessagesForEachRow();
     //Confirm that 3 models where created.
     $tasks = Task::getAll();
     $this->assertEquals(3, count($tasks));
     $tasks = Task::getByName('task1');
     $this->assertEquals(1, count($tasks[0]));
     $this->assertEquals(1, count($tasks[0]->activityItems));
     $this->assertEquals('testAccount', $tasks[0]->activityItems[0]->name);
     $this->assertEquals('Account', get_class($tasks[0]->activityItems[0]));
     $this->assertFalse((bool) $tasks[0]->completed);
     $this->assertEquals(Task::STATUS_NEW, $tasks[0]->status);
     $this->assertEquals($actionDateTime, substr($tasks[0]->latestDateTime, 0, -3));
     $tasks = Task::getByName('task2');
     $this->assertEquals(1, count($tasks[0]));
     $this->assertEquals(1, count($tasks[0]->activityItems));
     $this->assertEquals('testContact', $tasks[0]->activityItems[0]->firstName);
     $this->assertEquals('Contact', get_class($tasks[0]->activityItems[0]));
     $this->assertTrue((bool) $tasks[0]->completed);
     $this->assertEquals(Task::STATUS_COMPLETED, $tasks[0]->status);
     $this->assertEquals('2011-12-22 06:03', substr($tasks[0]->latestDateTime, 0, -3));
     $tasks = Task::getByName('task3');
     $this->assertEquals(1, count($tasks[0]));
     $this->assertEquals(1, count($tasks[0]->activityItems));
     $this->assertEquals('testOpportunity', $tasks[0]->activityItems[0]->name);
     $this->assertEquals('Opportunity', get_class($tasks[0]->activityItems[0]));
     $this->assertFalse((bool) $tasks[0]->completed);
     $this->assertEquals(Task::STATUS_IN_PROGRESS, $tasks[0]->status);
     //Not checking the minutes because sometimes it was failing for one minute
     $this->assertEquals(substr($actionDateTime, 0, -2), substr($tasks[0]->latestDateTime, 0, -5));
     //Confirm 10 rows were processed as 'created'.
     $this->assertEquals(3, ImportDatabaseUtil::getCount($import->getTempTableName(), "status = " . ImportRowDataResultsUtil::CREATED));
     //Confirm that 0 rows were processed as 'updated'.
     $this->assertEquals(0, ImportDatabaseUtil::getCount($import->getTempTableName(), "status = " . ImportRowDataResultsUtil::UPDATED));
     //Confirm 2 rows were processed as 'errors'.
     $this->assertEquals(0, ImportDatabaseUtil::getCount($import->getTempTableName(), "status = " . ImportRowDataResultsUtil::ERROR));
     $beansWithErrors = ImportDatabaseUtil::getSubset($import->getTempTableName(), "status = " . ImportRowDataResultsUtil::ERROR);
     $this->assertEquals(0, count($beansWithErrors));
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:62,代码来源:TaskImportTest.php

示例11: testUpdateTaskFromForm

 /**
  * @depends testCreateAndGetTaskById
  */
 public function testUpdateTaskFromForm()
 {
     Yii::app()->user->userModel = User::getByUsername('super');
     $user = User::getByUsername('billy');
     $tasks = Task::getByName('MyTask');
     $task = $tasks[0];
     $this->assertEquals($task->name, 'MyTask');
     $postData = array('owner' => array('id' => $user->id), 'name' => 'New Name', 'dueDateTime' => '');
     $sanitizedPostData = PostUtil::sanitizePostByDesignerTypeForSavingModel($task, $postData);
     $task->setAttributes($sanitizedPostData);
     $this->assertTrue($task->save());
     $id = $task->id;
     unset($task);
     $task = Task::getById($id);
     $this->assertEquals('New Name', $task->name);
     $this->assertEquals(null, $task->dueDateTime);
     //create new task from scratch where the DateTime attributes are not populated. It should let you save.
     $task = new Task();
     $postData = array('owner' => array('id' => $user->id), 'name' => 'Lamazing', 'dueDateTime' => '');
     $sanitizedPostData = PostUtil::sanitizePostByDesignerTypeForSavingModel($task, $postData);
     $task->setAttributes($sanitizedPostData);
     $this->assertTrue($task->save());
     $id = $task->id;
     unset($task);
     $task = Task::getById($id);
     $this->assertEquals('Lamazing', $task->name);
     $this->assertEquals(null, $task->dueDateTime);
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:31,代码来源:TaskTest.php


注:本文中的Task::getByName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。