TestRv::TestRvDefault()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 14
rs 9.7998
c 0
b 0
f 0
1
<?php
2
/**
3
 * Test - Return value class
4
 *
5
 * @package     fwolflib
6
 * @subpackage	class.test
7
 * @copyright   Copyright 2013, Fwolf
8
 * @author      Fwolf <[email protected]>
9
 * @since		2013-05-03
10
 */
11
12
// Define like this, so test can run both under eclipse and web alone.
13
// {{{
14
if (! defined('SIMPLE_TEST')) {
15
	define('SIMPLE_TEST', 'simpletest/');
16
	require_once(SIMPLE_TEST . 'autorun.php');
17
}
18
// Then set output encoding
19
//header('Content-Type: text/html; charset=utf-8');
20
// }}}
21
22
// Require library define file which need test
23
require_once(dirname(__FILE__) . '/../fwolflib.php');
24
require_once(FWOLFLIB . 'class/rv/rv.php');
25
require_once(FWOLFLIB . 'func/ecl.php');
26
require_once(FWOLFLIB . 'func/request.php');
27
require_once(FWOLFLIB . 'func/string.php');
28
29
class TestRv extends UnitTestCase {
30
31
	/**
32
	 * Constructor
33
	 */
34
	public function __construct () {
35
36
	} // end of func __construct
37
38
39
	public function TestRvDefault () {
40
		$rv = new Rv();
0 ignored issues
show
Deprecated Code introduced by
The class Rv has been deprecated with message: Use Fwlib\Base\ReturnValue

This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.

Loading history...
41
42
		$this->assertEqual(0, $rv->Code());
43
		$this->assertEqual('hi', $rv->Msg('hi'));
44
		$this->assertEqual('hi', $rv->Msg(null));
45
		$this->assertEqual(null, $rv->Msg(null, true));
46
47
		$rv->Code(3);
48
		$this->assertEqual(false, $rv->Error());
49
		$rv->Code(-3);
50
		$this->assertEqual(true, $rv->Error());
51
52
	} // end of func TestRvDefault
53
54
55
} // end of class TestRv
56
57
58
// Change output charset in this way.
59
// {{{
60
$s_url = GetSelfUrl(false);
0 ignored issues
show
Deprecated Code introduced by
The function GetSelfUrl() has been deprecated with message: Use Fwlib\Util\HttpUtil::getSelfUrl()

This function has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed from the class and what other function to use instead.

Loading history...
61
$s_url = substr($s_url, strrpos($s_url, '/') + 1);
62
if ('rv.test.php' == $s_url) {
63
	$test = new TestRv();
64
	$test->run(new HtmlReporter('utf-8'));
65
}
66
// }}}
67
?>
0 ignored issues
show
Best Practice introduced by
It is not recommended to use PHP's closing tag ?> in files other than templates.

Using a closing tag in PHP files that only contain PHP code is not recommended as you might accidentally add whitespace after the closing tag which would then be output by PHP. This can cause severe problems, for example headers cannot be sent anymore.

A simple precaution is to leave off the closing tag as it is not required, and it also has no negative effects whatsoever.

Loading history...
68