Skip to content

Commit c9f6be4

Browse files
committed
split parseScan test into several methods
1 parent 5044ae9 commit c9f6be4

File tree

1 file changed

+31
-11
lines changed

1 file changed

+31
-11
lines changed

tests/Net_WifiTest.php

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -245,13 +245,16 @@ function testParseCurrentConfig()
245245
*
246246
* @return void
247247
*/
248-
function testParseScan()
248+
function testParseScanNoPeers()
249249
{
250250
//no peers
251251
$arLines = array("eth1 No scan results");
252252
$arCells = $this->wls->parseScan($arLines);
253253
$this->assertEquals(0, count($arCells));
254+
}
254255

256+
function testParseScanSomePeers()
257+
{
255258
//some peers
256259
//driver: ipw2200 0.21, acer travelmate 6003
257260
$arLines = array(
@@ -422,9 +425,10 @@ function testParseScan()
422425
$this->assertEquals(array('TKIP') , $arCells[3]->wpa2_group_cipher);
423426
$this->assertEquals(array('CCMP') , $arCells[3]->wpa2_pairwise_cipher);
424427
$this->assertEquals(array('PSK') , $arCells[3]->wpa2_auth_suite);
428+
}
425429

426-
427-
//some other peers
430+
function testParseScanSomeOtherPeers()
431+
{
428432
//driver: ipw2100 ???, samsung x10
429433
$arLines = array(
430434
"eth2 Scan completed :",
@@ -470,8 +474,13 @@ function testParseScan()
470474
$this->assertEquals(-88 , $arCells[0]->rssi);
471475
$this->assertEquals(747642 , $arCells[0]->beacon);
472476

477+
}
473478

474-
//with ipw2200 1.0 we've got "Signal level=..." instead of "Extra: Signal"
479+
/**
480+
* with ipw2200 1.0 we've got "Signal level=..." instead of "Extra: Signal"
481+
*/
482+
function testParseScanSignalLevel()
483+
{
475484
$arLines = array(
476485
"eth1 Scan completed :",
477486
" Cell 01 - Address: 00:03:C9:44:34:2C",
@@ -495,9 +504,13 @@ function testParseScan()
495504
//different signal name
496505
$this->assertEquals(-51 , $arCells[0]->rssi);
497506
$this->assertEquals(9 , $arCells[0]->beacon);
507+
}
498508

499-
500-
//ipw2200 1.0.1
509+
/**
510+
* ipw2200 1.0.1
511+
*/
512+
function testParseScanIpw2200v101()
513+
{
501514
$arLines = array(
502515
"eth1 Scan completed :",
503516
" Cell 01 - Address: 00:0D:BC:68:28:1A",
@@ -530,10 +543,13 @@ function testParseScan()
530543
$this->assertEquals('Rai Private' , $arCells[0]->ssid);
531544
$this->assertEquals(-60 , $arCells[0]->rssi);
532545
$this->assertEquals(59 , $arCells[0]->beacon);
546+
}
533547

534-
535-
536-
//ipw2100 carsten (unknown version)
548+
/**
549+
* ipw2100 carsten (unknown version)
550+
*/
551+
function testParseScanUnknownSize()
552+
{
537553
$arLines = array(
538554
'eth1 Scan completed :',
539555
' Cell 01 - Address: 00:12:D9:AC:BD:00',
@@ -563,9 +579,13 @@ function testParseScan()
563579
$this->assertEquals(18 , $arCells[0]->rate);
564580
$this->assertEquals(array(1.,2.,5.5,6.,9.,11.,12.,18.), $arCells[0]->rates);
565581
$this->assertEquals(false , $arCells[0]->encryption);
582+
}
566583

567-
568-
//ipw2200 kernel 2.18.1 (probably version 1.1.3)
584+
/**
585+
* ipw2200 kernel 2.18.1 (probably version 1.1.3)
586+
*/
587+
function testParseScanipw2200kernel2181()
588+
{
569589
$arLines = explode(
570590
"\n",
571591
<<<EOD

0 commit comments

Comments
 (0)