File tree Expand file tree Collapse file tree 4 files changed +15
-44
lines changed
Expand file tree Collapse file tree 4 files changed +15
-44
lines changed Original file line number Diff line number Diff line change 55 "phpunit/phpunit" : " ^6.0"
66 },
77 "autoload" : {
8- "psr-0" : {
9- "ntwIndia" : " "
10- },
11- "files" : [" ntwIndia/class-ntw-india.php" ]
8+ "psr-4" : {
9+ "ntwIndia\\ " : " src/"
10+ }
1211 }
1312}
Original file line number Diff line number Diff line change 22<phpunit colors =" true" >
33 <testsuites >
44 <testsuite name =" Application Test Suite" >
5- <directory >./ntwIndia/Test /</directory >
5+ <directory >./test /</directory >
66 </testsuite >
77 </testsuites >
88</phpunit >
Original file line number Diff line number Diff line change 66 * PHP Library
77 *
88 * @author Swashata Ghosh <swashata@iptms.co>
9- * @license GPLv3
9+ * @license GPL-v3.0
1010 */
1111class NTW_India {
1212 /**
Original file line number Diff line number Diff line change 11<?php
2- namespace ntwIndia \Test ;
3-
42class NTW_India_Test extends \PHPUnit \Framework \TestCase {
53 public $ ntw ;
64
7- public function __construct () {
5+ public function setUp () {
86 $ this ->ntw = new \ntwIndia \NTW_India ();
97 }
108
@@ -37,36 +35,7 @@ public function test_more_than_hundred() {
3735 }
3836
3937 public function test_less_than_hundred () {
40- $ num_to_wd = array (
41- '0 ' => 'Zero ' ,
42- '1 ' => 'One ' ,
43- '2 ' => 'Two ' ,
44- '3 ' => 'Three ' ,
45- '4 ' => 'Four ' ,
46- '5 ' => 'Five ' ,
47- '6 ' => 'Six ' ,
48- '7 ' => 'Seven ' ,
49- '8 ' => 'Eight ' ,
50- '9 ' => 'Nine ' ,
51- '10 ' => 'Ten ' ,
52- '11 ' => 'Eleven ' ,
53- '12 ' => 'Twelve ' ,
54- '13 ' => 'Thirteen ' ,
55- '14 ' => 'Fourteen ' ,
56- '15 ' => 'Fifteen ' ,
57- '16 ' => 'Sixteen ' ,
58- '17 ' => 'Seventeen ' ,
59- '18 ' => 'Eighteen ' ,
60- '19 ' => 'Nineteen ' ,
61- '20 ' => 'Twenty ' ,
62- '30 ' => 'Thirty ' ,
63- '40 ' => 'Forty ' ,
64- '50 ' => 'Fifty ' ,
65- '60 ' => 'Sixty ' ,
66- '70 ' => 'Seventy ' ,
67- '80 ' => 'Eighty ' ,
68- '90 ' => 'Ninety ' ,
69- );
38+ $ num_to_wd = $ this ->get_num_to_word ();
7039
7140 foreach ( $ num_to_wd as $ num => $ wd ) {
7241 $ this ->assertEquals ( $ wd , $ this ->ntw ->num_to_word ( $ num ) );
@@ -80,7 +49,14 @@ public function test_zero_value() {
8049 }
8150
8251 public function test_num_to_wd_small () {
83- $ num_to_wd = array (
52+ $ num_to_wd = $ this ->get_num_to_word ();
53+ foreach ( $ num_to_wd as $ num => $ wd ) {
54+ $ this ->assertEquals ( $ wd , $ this ->ntw ->num_to_wd_small ( $ num ) );
55+ }
56+ }
57+
58+ private function get_num_to_word () {
59+ return array (
8460 '0 ' => 'Zero ' ,
8561 '1 ' => 'One ' ,
8662 '2 ' => 'Two ' ,
@@ -110,9 +86,5 @@ public function test_num_to_wd_small() {
11086 '80 ' => 'Eighty ' ,
11187 '90 ' => 'Ninety ' ,
11288 );
113-
114- foreach ( $ num_to_wd as $ num => $ wd ) {
115- $ this ->assertEquals ( $ wd , $ this ->ntw ->num_to_wd_small ( $ num ) );
116- }
11789 }
11890}
You can’t perform that action at this time.
0 commit comments