-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GEOCODER_45 : activate openstreetmap during fresh install
- Loading branch information
1 parent
63fce6d
commit 6191932
Showing
2 changed files
with
173 additions
and
11 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
<?php | ||
|
||
class UpgraderTest extends \PHPUnit\Framework\TestCase { | ||
|
||
public function managedEntityHasNameDataProvider() { | ||
return [ | ||
[NULL, FALSE], | ||
["", FALSE], | ||
[["name" => "abc"], TRUE], | ||
|
||
]; | ||
|
||
} | ||
|
||
/** | ||
* @dataProvider managedEntityHasNameDataProvider | ||
* @param $entity | ||
* @param $expected | ||
* @return void | ||
* @throws ReflectionException | ||
*/ | ||
public function testManagedEntityHasName($entity, $expected) { | ||
$method = new ReflectionMethod("CRM_Geocoder_Upgrader::managedEntityHasName"); | ||
$method->setAccessible(TRUE); | ||
$computed = $method->invoke(NULL, $entity); | ||
$this->assertEquals($expected, $computed); | ||
} | ||
|
||
public function managedEntityIsEnabledOnInstallDataProvider() { | ||
return [ | ||
[NULL, FALSE], | ||
[[], FALSE], | ||
[["metadata" => NULL], FALSE], | ||
[["metadata" => []], FALSE], | ||
[["metadata" => ["is_enabled_on_install" => FALSE]], FALSE], | ||
[["metadata" => ["is_enabled_on_install" => TRUE]], TRUE], | ||
]; | ||
} | ||
|
||
/** | ||
* @dataProvider managedEntityIsEnabledOnInstallDataProvider | ||
* @param $entity | ||
* @param $expected | ||
* @return void | ||
* @throws ReflectionException | ||
*/ | ||
public function testManagedEntityIsEnabledOnInstall($entity, $expected) { | ||
$method = new ReflectionMethod("CRM_Geocoder_Upgrader::managedEntityIsEnabledOnInstall"); | ||
$method->setAccessible(TRUE); | ||
$computed = $method->invoke(NULL, $entity); | ||
$this->assertEquals($expected, $computed); | ||
} | ||
|
||
public function managedEntityIsNotActiveDataProvider() { | ||
return [ | ||
[NULL, FALSE], | ||
[[], FALSE], | ||
[["params" => NULL], FALSE], | ||
[["params" => []], FALSE], | ||
[["params" => ["is_active" => FALSE]], TRUE], | ||
[["metadata" => ["is_active" => TRUE]], FALSE], | ||
]; | ||
} | ||
|
||
/** | ||
* @dataProvider managedEntityIsNotActiveDataProvider | ||
* @param $entity | ||
* @param $expected | ||
* @return void | ||
* @throws ReflectionException | ||
*/ | ||
public function testManagedEntityIsNotActive($entity, $expected) { | ||
$method = new ReflectionMethod("CRM_Geocoder_Upgrader::managedEntityIsNotActive"); | ||
$method->setAccessible(TRUE); | ||
$computed = $method->invoke(NULL, $entity); | ||
$this->assertEquals($expected, $computed); | ||
} | ||
|
||
} |