Skip to content

Commit

Permalink
Add tests for custom fields listing and new field form.
Browse files Browse the repository at this point in the history
  • Loading branch information
nirix committed Jul 25, 2016
1 parent 05ec0ae commit bbfebb1
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/views/project_settings/custom_fields/new.phtml
Expand Up @@ -2,7 +2,7 @@

<?php $this->startSection('content'); ?>
<div class="project-settings new-custom-field content container">
<h2 class="page-header"><?=t('new_custom_field')?></h2>
<h1 class="page-header"><?=t('new_custom_field')?></h1>

<form action="<?=routeUrl('project_settings_create_custom_field')?>" method="post" class="form-horizontal">
<?=View::render('project_settings/custom_fields/_form.phtml', ['field' => $field])?>
Expand Down
1 change: 1 addition & 0 deletions tests/test.php
Expand Up @@ -49,6 +49,7 @@
require __DIR__ . '/tests/requests/project_settings/options.php';
require __DIR__ . '/tests/requests/project_settings/milestones.php';
require __DIR__ . '/tests/requests/project_settings/components.php';
require __DIR__ . '/tests/requests/project_settings/custom_fields.php';

// Projects
require __DIR__ . '/tests/requests/projects/roadmap.php';
Expand Down
35 changes: 35 additions & 0 deletions tests/tests/requests/project_settings/custom_fields.php
@@ -0,0 +1,35 @@
<?php

$testSuite->createGroup('Requests / Project Settings / Custom Fields', function ($g) {
$manager = createProjectManager();
$project = $manager->project();
$user = $manager->user();

$g->test('List custom fields', function ($t) use ($project, $user) {
$resp = $t->visit('project_settings_custom_fields', [
'routeTokens' => [
'pslug' => $project['slug']
],
'cookie' => [
'traq' => $user['session_hash']
]
]);

$t->assertEquals(200, $resp->status);
$t->assertContains('<h1 class="page-header">Custom Fields</h1>', $resp->body);
});

$g->test('New custom field', function ($t) use ($project, $user) {
$resp = $t->visit('project_settings_new_custom_field', [
'routeTokens' => [
'pslug' => $project['slug']
],
'cookie' => [
'traq' => $user['session_hash']
]
]);

$t->assertEquals(200, $resp->status);
$t->assertContains('<h1 class="page-header">New Custom Field</h1>', $resp->body);
});
});

0 comments on commit bbfebb1

Please sign in to comment.