This repository was archived by the owner on Jul 27, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathAssetsTest.php
64 lines (54 loc) · 2.41 KB
/
AssetsTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
namespace tests;
use tests\overrides\TestGeoCoderAsset;
use tests\overrides\TestServiceBingAsset;
use tests\overrides\TestServiceMapQuestAsset;
use tests\overrides\TestServiceNominatimAsset;
use yii\web\AssetBundle;
class AssetsTest extends TestCase
{
public function testGeoCoderAssetRegister()
{
$view = $this->getView();
$this->assertEmpty($view->assetBundles);
TestGeoCoderAsset::register($view);
$this->assertCount(2,$view->assetBundles);
$this->assertTrue($view->assetBundles['tests\\overrides\\TestGeoCoderAsset'] instanceof AssetBundle);
$content = $view->render('//layouts/rawlayout.php');
$this->assertContains('leaflet-src.js', $content);
$this->assertContains('l.control.geocoder.js', $content);
}
public function testServiceBingAssetRegister()
{
$view = $this->getView();
$this->assertEmpty($view->assetBundles);
TestServiceBingAsset::register($view);
$this->assertCount(3,$view->assetBundles);
$this->assertTrue($view->assetBundles['tests\\overrides\\TestServiceBingAsset'] instanceof AssetBundle);
$content = $view->render('//layouts/rawlayout.php');
$this->assertContains('leaflet-src.js', $content);
$this->assertContains('l.control.geocoder.bing.js', $content);
}
public function testServiceMapQuestAssetRegister()
{
$view = $this->getView();
$this->assertEmpty($view->assetBundles);
TestServiceMapQuestAsset::register($view);
$this->assertCount(3,$view->assetBundles);
$this->assertTrue($view->assetBundles['tests\\overrides\\TestGeoCoderAsset'] instanceof AssetBundle);
$content = $view->render('//layouts/rawlayout.php');
$this->assertContains('leaflet-src.js', $content);
$this->assertContains('l.control.geocoder.mapquest.js', $content);
}
public function testServiceNominatimAssetRegister()
{
$view = $this->getView();
$this->assertEmpty($view->assetBundles);
TestServiceNominatimAsset::register($view);
$this->assertCount(3,$view->assetBundles);
$this->assertTrue($view->assetBundles['tests\\overrides\\TestGeoCoderAsset'] instanceof AssetBundle);
$content = $view->render('//layouts/rawlayout.php');
$this->assertContains('leaflet-src.js', $content);
$this->assertContains('l.control.geocoder.nominatim.js', $content);
}
}