11<?php
2+
23class CreateTest extends PHPUnit_Framework_TestCase
34{
45 protected static $ port , $ tm ;
@@ -89,7 +90,7 @@ public function test_05_flush()
8990 * @expectedException Exception
9091 * @expectedExceptionMessage Query error
9192 */
92- public function test_06_bad_cridentials ()
93+ public function test_06_bad_credentials ()
9394 {
9495 $ c = new Tarantool ('localhost ' , self ::$ port );
9596 $ c ->connect ();
@@ -101,7 +102,7 @@ public function test_06_bad_cridentials()
101102 * @expectedException Exception
102103 * @expectedExceptionMessage Query error
103104 */
104- public function test_07_bad_guest_cridentials ()
105+ public function test_07_bad_guest_credentials ()
105106 {
106107 $ c = new Tarantool ('localhost ' , self ::$ port );
107108 $ c ->connect ();
@@ -113,20 +114,36 @@ public function test_07_bad_guest_cridentials()
113114 * @expectedException Exception
114115 * @expectedExceptionMessage Query error
115116 */
116- public function test_07_01_bad_guest_cridentials ()
117+ public function test_07_01_bad_guest_credentials ()
117118 {
118119 $ c = new Tarantool ('localhost ' , self ::$ port );
119120 $ c ->connect ();
120121 $ this ->assertTrue ($ c ->ping ());
121122 $ c ->authenticate ('guest ' , '' );
122123 }
123124
124- public function test_08_good_cridentials ()
125+ /**
126+ * @dataProvider provideGoodCredentials
127+ */
128+ public function test_08_good_credentials ($ username , $ password = null )
125129 {
126130 $ c = new Tarantool ('localhost ' , self ::$ port );
127131 $ c ->connect ();
128132 $ this ->assertTrue ($ c ->ping ());
129- $ c ->authenticate ('guest ' );
133+
134+ (1 === func_num_args ())
135+ ? $ c ->authenticate ($ username )
136+ : $ c ->authenticate ($ username , $ password );
137+
130138 $ this ->assertTrue ($ c ->ping ());
131139 }
140+
141+ public static function provideGoodCredentials ()
142+ {
143+ return [
144+ ['guest ' ],
145+ ['guest ' , null ],
146+ ];
147+ }
132148}
149+
0 commit comments