@@ -121,4 +121,48 @@ public function test_built_where_disabled()
121121
122122 $ this ->assertEquals ('(UserAccountControl:1.2.840.113556.1.4.803:=2) ' , $ b ->getQuery ()->getQuery ());
123123 }
124+
125+ public function test_select_with_variadic_arguments ()
126+ {
127+ $ b = $ this ->newBuilder ();
128+
129+ $ selects = $ b ->select ('cn ' , 'description ' )->getSelects ();
130+
131+ $ this ->assertContains ('cn ' , $ selects );
132+ $ this ->assertContains ('description ' , $ selects );
133+ $ this ->assertContains ('objectguid ' , $ selects ); // GUID key always included
134+ }
135+
136+ public function test_select_with_array_argument ()
137+ {
138+ $ b = $ this ->newBuilder ();
139+
140+ $ selects = $ b ->select (['cn ' , 'description ' ])->getSelects ();
141+
142+ $ this ->assertContains ('cn ' , $ selects );
143+ $ this ->assertContains ('description ' , $ selects );
144+ $ this ->assertContains ('objectguid ' , $ selects );
145+ }
146+
147+ public function test_select_with_empty_array_defaults_to_all ()
148+ {
149+ $ b = $ this ->newBuilder ();
150+
151+ $ selects = $ b ->select ([])->getSelects ();
152+
153+ $ this ->assertContains ('* ' , $ selects );
154+ $ this ->assertContains ('objectguid ' , $ selects );
155+ }
156+
157+ public function test_add_select_with_variadic_arguments ()
158+ {
159+ $ b = $ this ->newBuilder ();
160+
161+ $ selects = $ b ->select ('cn ' )->addSelect ('description ' , 'mail ' )->getSelects ();
162+
163+ $ this ->assertContains ('cn ' , $ selects );
164+ $ this ->assertContains ('description ' , $ selects );
165+ $ this ->assertContains ('mail ' , $ selects );
166+ $ this ->assertContains ('objectguid ' , $ selects );
167+ }
124168}
0 commit comments