Added Kohana v3.0.8
This commit is contained in:
66
includes/kohana/modules/unittest/views/unittest/index.php
Normal file
66
includes/kohana/modules/unittest/views/unittest/index.php
Normal file
@@ -0,0 +1,66 @@
|
||||
<?php defined('SYSPATH') or die('No direct script access.') ?>
|
||||
|
||||
<div id="select">
|
||||
<h1>PHPUnit for Kohana 3</h1>
|
||||
<div id="groups">
|
||||
<fieldset class="tests">
|
||||
<legend>Run Tests</legend>
|
||||
<?php echo Form::open($run_uri, array('method' => 'GET'));?>
|
||||
|
||||
<?php echo Form::label('run_group', __('Run a test group')) ?>
|
||||
<?php echo Form::select('group', $groups, NULL, array('id' => 'run_group'));?>
|
||||
|
||||
<?php if ($xdebug_enabled): ?>
|
||||
<?php echo Form::label('run_collect_cc', __('Calculate code coverage')) ?>
|
||||
<?php echo Form::checkbox('collect_cc', 1, TRUE, array('id' => 'run_collect_cc')) ?>
|
||||
|
||||
<div depends_on="#run_collect_cc">
|
||||
<?php echo Form::label('run_use_whitelist', __('Use code coverage whitelist'));?>
|
||||
<?php echo Form::checkbox('use_whitelist', 1, TRUE, array('id' => 'run_use_whitelist')) ?>
|
||||
|
||||
<div depends_on="#run_use_whitelist">
|
||||
<?php echo Form::label('run_whitelist', __('Only calculate coverage for files in selected modules')) ?>
|
||||
<?php echo Form::select('whitelist[]', $whitelistable_items, array(), array('id' => 'run_whitelist', 'multiple' => 'multiple')) ?>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<?php endif ?>
|
||||
|
||||
<?php echo Form::submit('submit', 'Run');?>
|
||||
<?php echo Form::close();?>
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="reports">
|
||||
<legend>Code Coverage Reports</legend>
|
||||
<?php if ( ! $xdebug_enabled): ?>
|
||||
<p><?php echo __('Xdebug needs to be installed to generate reports') ?></p>
|
||||
<?php else: ?>
|
||||
<?php echo Form::open($report_uri, array('method' => 'GET')) ?>
|
||||
|
||||
<?php echo Form::label('cc_group', __('Generate report for')) ?>
|
||||
<?php echo Form::select('group', $groups, NULL, array('id' => 'cc_group'));?>
|
||||
|
||||
<?php echo Form::label('report_archive', __('Download as archive?'));?>
|
||||
<?php echo Form::checkbox('archive', 1, FALSE, array('id' => 'report_archive')) ?>
|
||||
|
||||
<?php echo Form::label('report_use_whitelist', __('Use code coverage whitelist'));?>
|
||||
<?php echo Form::checkbox('use_whitelist', 1, TRUE, array('id' => 'report_use_whitelist')) ?>
|
||||
|
||||
<div depends_on="#report_use_whitelist">
|
||||
<?php echo Form::label('run_whitelist', __('Only calculate coverage for files in selected modules')) ?>
|
||||
<?php echo Form::select('whitelist[]', $whitelistable_items, array(), array('id' => 'run_whitelist', 'multiple' => 'multiple')) ?>
|
||||
</div>
|
||||
|
||||
<?php echo Form::submit('submit', 'Run');?>
|
||||
<?php echo Form::close();?>
|
||||
<?php endif ?>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
<h2>Useful links</h2>
|
||||
<ul>
|
||||
<li><a href="http://www.phpunit.de/manual/current/en/">PHPUnit Manual</a></li>
|
||||
<li><a href="http://github.com/kohana/unittest">Module README</a></li>
|
||||
</ul>
|
||||
</div>
|
255
includes/kohana/modules/unittest/views/unittest/layout.php
Normal file
255
includes/kohana/modules/unittest/views/unittest/layout.php
Normal file
@@ -0,0 +1,255 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
|
||||
<title>PHPUnit for Kohana</title>
|
||||
|
||||
<style type="text/css">
|
||||
#select {
|
||||
font-family: sans-serif;
|
||||
border: 2px solid black;
|
||||
padding: 20px;
|
||||
margin: 40px 80px;
|
||||
}
|
||||
#select #groups {
|
||||
overflow: auto;
|
||||
margin-bottom: 25px;
|
||||
}
|
||||
#header {
|
||||
background-color: #263038;
|
||||
color: #fff;
|
||||
padding: 20px;
|
||||
font-family: sans-serif;
|
||||
overflow: auto;
|
||||
}
|
||||
#header span {
|
||||
display: block;
|
||||
color: #83919C;
|
||||
margin: 5px 0 0 0;
|
||||
}
|
||||
#header span b {
|
||||
color: #ddd;
|
||||
}
|
||||
#header span.code_coverage .excellent {
|
||||
color: #13CC1C;
|
||||
}
|
||||
#header span.code_coverage .ok {
|
||||
color: #448BFD;
|
||||
}
|
||||
#header span.code_coverage .terrible {
|
||||
color: #FF0A0A;
|
||||
}
|
||||
|
||||
#header fieldset form label {
|
||||
display: block;
|
||||
}
|
||||
|
||||
#header a {
|
||||
color: #4e7aa0;
|
||||
}
|
||||
|
||||
li {
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
fieldset {
|
||||
color: #000;
|
||||
background: #E5EFF8;
|
||||
border: 4px solid #4D6171;
|
||||
padding: 20px 20px 0px;
|
||||
font-size: 1.2em;
|
||||
width: 43%;
|
||||
display: block;
|
||||
-moz-border-radius: 2px;
|
||||
}
|
||||
|
||||
fieldset legend {
|
||||
padding: 5px;
|
||||
-moz-border-radius: 2px;
|
||||
color: #FEFEFE;
|
||||
background: #4D6171;
|
||||
}
|
||||
form {
|
||||
display: inline;
|
||||
}
|
||||
fieldset form {
|
||||
display: block;
|
||||
}
|
||||
fieldset#results-options {
|
||||
width: 38%;
|
||||
float:right;
|
||||
}
|
||||
fieldset form label {
|
||||
display: block;
|
||||
}
|
||||
|
||||
fieldset select {
|
||||
width: 45%;
|
||||
}
|
||||
|
||||
fieldset#results-options form label {
|
||||
clear: left;
|
||||
float: left;
|
||||
width: 43%;
|
||||
}
|
||||
|
||||
fieldset#results-options form input {
|
||||
display: block;
|
||||
float:left;
|
||||
}
|
||||
|
||||
fieldset#results-options form input[type="submit"] {
|
||||
float: none;
|
||||
clear: both;
|
||||
}
|
||||
|
||||
fieldset#results-options form select {
|
||||
float: left;
|
||||
}
|
||||
|
||||
fieldset.tests {
|
||||
float: left;
|
||||
}
|
||||
|
||||
fieldset.tests legend {
|
||||
background: #4D6171;
|
||||
|
||||
}
|
||||
|
||||
fieldset.reports {
|
||||
float: right;
|
||||
background: #FC817B;
|
||||
border-color: #D02820;
|
||||
}
|
||||
|
||||
fieldset.reports legend {
|
||||
background: #D02820;
|
||||
}
|
||||
|
||||
fieldset form input[type="submit"] {
|
||||
margin-top: 15px;
|
||||
display: block;
|
||||
}
|
||||
|
||||
|
||||
#results {
|
||||
font-family: sans-serif;
|
||||
}
|
||||
#results > div {
|
||||
margin-top: 10px;
|
||||
padding: 20px;
|
||||
}
|
||||
#results > div ol li{
|
||||
font-size: 1.1em;
|
||||
margin-bottom: 15px;
|
||||
font-weight: bold;
|
||||
}
|
||||
h1, h2 {
|
||||
margin: 0 0 15px;
|
||||
}
|
||||
div.failures-list {
|
||||
background-color: #ffcccc;
|
||||
}
|
||||
div.errors-list {
|
||||
background-color: #ffc;
|
||||
}
|
||||
span.test-case {
|
||||
color: #83919C;
|
||||
}
|
||||
span.test-name {
|
||||
color: #222;
|
||||
}
|
||||
span.test-data-set {
|
||||
display: block;
|
||||
color: #666;
|
||||
font-weight: normal;
|
||||
}
|
||||
span.test-message {
|
||||
display: block;
|
||||
color: #444;
|
||||
}
|
||||
div.big-message {
|
||||
font-size: 2em;
|
||||
text-align: center;
|
||||
}
|
||||
div.all-pass {
|
||||
background-color: #E0FFE0;
|
||||
border: 3px solid #b0FFb0;
|
||||
}
|
||||
div.no-tests {
|
||||
background-color: #FFFFE0;
|
||||
border: 3px solid #FFFFb0;
|
||||
}
|
||||
span.show {
|
||||
font-size: 0.7em;
|
||||
font-weight: normal;
|
||||
color:#4D6171;
|
||||
}
|
||||
.hidden {
|
||||
display: none;
|
||||
}
|
||||
span[title]{
|
||||
border-bottom: 1px dashed #83919C;
|
||||
}
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<?php echo $body ?>
|
||||
|
||||
<?php echo HTML::script('http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js') ?>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
|
||||
// Using our own attribute is a little messy but gets the job done
|
||||
// this isn't very important code anyway...
|
||||
$('[depends_on]').each(function(){
|
||||
var dependent = $(this);
|
||||
var controller = $(dependent.attr('depends_on'));
|
||||
|
||||
// We do this in the loop so that it can access dependent
|
||||
// Javascript scopes are slightly crazy
|
||||
var toggler = function(){
|
||||
if ($(this).attr('checked')){
|
||||
dependent.show();
|
||||
} else {
|
||||
dependent.hide();
|
||||
}
|
||||
}
|
||||
|
||||
// Register the toggler
|
||||
controller.change(toggler);
|
||||
|
||||
// And degrade nicely...
|
||||
if ( ! controller.attr('checked')){
|
||||
dependent.hide();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
document.write('<style type="text/css"> .collapsed { display: none; } </style>');
|
||||
function toggle(type)
|
||||
{
|
||||
var elem = document.getElementById(type+'-ol');
|
||||
var plus = document.getElementById(type+'-show');
|
||||
|
||||
if (elem.style && elem.style['display'])
|
||||
// Only works with the "style" attr
|
||||
var disp = elem.style['display'];
|
||||
else if (elem.currentStyle)
|
||||
// For MSIE, naturally
|
||||
var disp = elem.currentStyle['display'];
|
||||
else if (window.getComputedStyle)
|
||||
// For most other browsers
|
||||
var disp = document.defaultView.getComputedStyle(elem, null).getPropertyValue('display');
|
||||
|
||||
// Toggle the state of the "display" style
|
||||
elem.style.display = disp == 'block' ? 'none' : 'block';
|
||||
plus.innerHTML = disp == 'block' ? '[<?php echo __('show') ?>]' : '[<?php echo __('hide') ?>]';
|
||||
return false;
|
||||
}
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
83
includes/kohana/modules/unittest/views/unittest/results.php
Normal file
83
includes/kohana/modules/unittest/views/unittest/results.php
Normal file
@@ -0,0 +1,83 @@
|
||||
<?php defined('SYSPATH') or die('No direct script access.') ?>
|
||||
<div id="header" class="results">
|
||||
<fieldset id="results-options">
|
||||
<legend>Options</legend>
|
||||
<?php echo Form::open(NULL, array('method' => 'get'));?>
|
||||
<?php echo Form::label('group', __('Switch Group')) ?>
|
||||
<?php echo Form::select('group', $groups, $group, array('id' => 'group'));?>
|
||||
<?php if ($xdebug_enabled): ?>
|
||||
<?php echo Form::label('collect_cc', __('Collect Coverage')) ?>
|
||||
<?php echo Form::checkbox('collect_cc', 1, isset($coverage), array('id' => 'collect_cc')) ?>
|
||||
<div depends_on="#collect_cc">
|
||||
<?php echo Form::label('use_whitelist', __('Use whitelist'));?>
|
||||
<?php echo Form::checkbox('use_whitelist', 1, $whitelist, array('id' => 'use_whitelist')) ?>
|
||||
|
||||
<div depends_on="#use_whitelist">
|
||||
<?php echo Form::label('whitelist', __('Whitelisted modules')) ?>
|
||||
<?php echo Form::select('whitelist[]', $whitelistable_items, $whitelisted_items, array('id' => 'whitelist', 'multiple' => 'multiple')) ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif ?>
|
||||
<?php echo Form::submit('run', 'Run');?>
|
||||
<?php echo Form::close();?>
|
||||
</fieldset>
|
||||
<h1><?php echo (is_null($group) ? __('All Groups') : __('Group').': ')?> <?php echo $group?></h1>
|
||||
<span class="time"><?php echo __('Time') ?>: <b><?php echo $time?></b></span>
|
||||
<span class="summary">
|
||||
<?php echo __('Tests') ?> <b><?php echo $totals['tests']?></b>,
|
||||
<?php echo __('Assertions') ?> <b><?php echo $totals['assertions']?></b>,
|
||||
<?php echo __('Failures') ?> <b><?php echo $totals['failures']?></b>,
|
||||
<?php echo __('Skipped') ?> <b><?php echo $totals['skipped']?></b>,
|
||||
<?php echo __('Errors') ?> <b><?php echo $totals['errors']?></b>.
|
||||
</span>
|
||||
<?php if ($xdebug_enabled AND isset($coverage)): ?>
|
||||
<span class="code_coverage">
|
||||
<?php $level_class = ($coverage > 75 ? 'excellent' : ($coverage > 35 ? 'ok' : 'terrible')) ?>
|
||||
<?php
|
||||
echo __('Tests covered :percent of the :codebase',
|
||||
array
|
||||
(
|
||||
':percent' => '<b class="'.$level_class.'">'.num::format($coverage, 2).'%</b>',
|
||||
':codebase' => ( ! empty($coverage_explanation) ? '<span title="'.$coverage_explanation.'" style="display:inline;">modules</span>' : 'codebase')
|
||||
)
|
||||
);
|
||||
?>,
|
||||
<?php echo HTML::anchor($report_uri, 'View') ?>
|
||||
or
|
||||
<?php echo HTML::anchor($report_uri.'&archive=1', 'Download') ?>
|
||||
the report
|
||||
</span>
|
||||
<?php endif ?>
|
||||
</div>
|
||||
|
||||
<div id="results">
|
||||
<?php if ($totals['tests'] == 0): ?>
|
||||
<div class="big-message no-tests">No tests in group</div>
|
||||
<?php elseif ($totals['tests'] === $totals['passed']): ?>
|
||||
<div class="big-message all-pass"><?php echo $totals['tests']?> Tests Passed</div>
|
||||
<?php else: ?>
|
||||
|
||||
<?php foreach ($results as $type => $tests):?>
|
||||
<?php if (count($tests) < 1):
|
||||
continue;
|
||||
endif ?>
|
||||
<?php $hide = ($type === 'skipped' OR $type === 'incomplete') ?>
|
||||
<div class="<?php echo $type?>-list">
|
||||
<h2 onclick="toggle('<?php echo $type?>');"><?php echo count($tests)?>
|
||||
<?php echo __(ucfirst(Inflector::singular($type, count($tests))))?>
|
||||
<span id="<?php echo $type?>-show" class="show">[<?php echo $hide ? __('show') : __('hide') ?>]</span></h2>
|
||||
<ol id="<?php echo $type?>-ol" class="<?php echo $hide ? 'hidden' : '' ?>">
|
||||
<?php foreach ($tests as $result): ?>
|
||||
<li>
|
||||
<span class="test-case"><?php echo $result['class']?>::</span><span class="test-name"><?php echo $result['test']?></span>
|
||||
<?php if ($result['data_set']) : ?>
|
||||
<span class="test-data-set"> <?php echo __('with data set')?> <span><?php echo $result['data_set']?></span></span>
|
||||
<?php endif ?>
|
||||
<span class="test-message"><?php echo htmlentities($result['message'])?></span>
|
||||
</li>
|
||||
<?php endforeach ?>
|
||||
</ol>
|
||||
</div>
|
||||
<?php endforeach;?>
|
||||
<?php endif ?>
|
||||
</div>
|
Reference in New Issue
Block a user