-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1238 from OpenDevelopmentMekong/master
Merging to prod for releasing v2.4.20
- Loading branch information
Showing
6 changed files
with
104 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
|
||
function arrays_have_common_items($array1, $array2) { | ||
|
||
foreach ($array1 as $value1): | ||
foreach ($array2 as $value2): | ||
if (strtolower($value1) == strtolower($value2)): | ||
return true; | ||
endif; | ||
endforeach; | ||
endforeach; | ||
|
||
return false; | ||
} | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
|
||
require_once dirname(dirname(__FILE__)) . '/inc/utils/arrays.php'; | ||
|
||
class ArraysTest extends PHPUnit_Framework_TestCase | ||
{ | ||
public function setUp() | ||
{ | ||
// init vars here | ||
} | ||
|
||
public function tearDown() | ||
{ | ||
// undo stuff here | ||
} | ||
|
||
public function testDummy(){ | ||
$this->assertTrue(true); | ||
} | ||
|
||
public function testArrayHaveCommonItems() | ||
{ | ||
$array1 = array("Economy and Commerce", "Disaster and emergency response", "Extractive Industries"); | ||
$array2 = array("Land", "Extractive Industries"); | ||
$result = arrays_have_common_items($array1,$array2); | ||
$this->assertEquals($result,true); | ||
} | ||
|
||
public function testArrayHaveCommonItemsIgnoreCase() | ||
{ | ||
$array1 = array("Economy and Commerce", "Disaster and emergency response", "Extractive Industries"); | ||
$array2 = array("Land", "Extractive industries"); | ||
$result = arrays_have_common_items($array1,$array2); | ||
$this->assertEquals($result,true); | ||
} | ||
|
||
public function testArrayHaveCommonItemsNegativeCase() | ||
{ | ||
$array1 = array("Labor", "Illegal labor"); | ||
$array2 = array("Agriculture and fishing", "Disaster and emergency response", "Environment and natural resources", "Extractive Industries", "Land"); | ||
$result = arrays_have_common_items($array1,$array2); | ||
$this->assertEquals($result,false); | ||
} | ||
} |