Skip to content

Commit 7d8d769

Browse files
Remove popper. (#11)
1 parent c5e43b3 commit 7d8d769

File tree

7 files changed

+13
-155
lines changed

7 files changed

+13
-155
lines changed

README.md

+7-25
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<a href="https://github.com/yii2-extensions/asset-bootstrap5" target="_blank">
33
<img src="https://www.yiiframework.com/image/yii_logo_light.svg" height="100px;">
44
</a>
5-
<h1 align="center">Asset for Twitter Bootstrap 5.</h1>
5+
<h1 align="center">Asset bundle for Twitter Bootstrap 5.</h1>
66
<br>
77
</p>
88

@@ -42,7 +42,7 @@ or add
4242

4343
to the require-dev section of your `composer.json` file.
4444

45-
## Usage
45+
## Basic usage
4646

4747
```php
4848
<?php
@@ -59,49 +59,31 @@ BootstrapAsset::register($this);
5959

6060
declare(strict_types=1);
6161

62-
use Yii2\Asset\BootstrapCdnAsset;
63-
64-
BootstrapCdnAsset::register($this);
65-
```
66-
67-
```php
68-
<?php
69-
70-
declare(strict_types=1);
71-
7262
use Yii2\Asset\BootstrapPluginAsset;
7363

7464
BootstrapPluginAsset::register($this);
7565
```
7666

77-
```php
78-
<?php
79-
80-
declare(strict_types=1);
81-
82-
use Yii2\Asset\BootstrapPluginCdnAsset;
83-
84-
BootstrapPluginCdnAsset::register($this);
85-
```
67+
## CDN usage
8668

8769
```php
8870
<?php
8971

9072
declare(strict_types=1);
9173

92-
use Yii2\Asset\PopperAsset;
74+
use Yii2\Asset\BootstrapCdnAsset;
9375

94-
PopperAsset::register($this);
76+
BootstrapCdnAsset::register($this);
9577
```
9678

9779
```php
9880
<?php
9981

10082
declare(strict_types=1);
10183

102-
use Yii2\Asset\PopperCdnAsset;
84+
use Yii2\Asset\BootstrapPluginCdnAsset;
10385

104-
PopperCdnAsset::register($this);
86+
BootstrapPluginCdnAsset::register($this);
10587
```
10688

10789
## Quality code

phpstan.neon

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
includes:
22
- vendor/yii2-extensions/phpstan/extension.neon
3+
34
parameters:
45
bootstrapFiles:
5-
- tests/bootstrap.php
6+
- tests/Support/bootstrap.php
67

78
dynamicConstantNames:
89
- YII_ENV

phpunit.xml.dist

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<phpunit
33
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
44
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.2/phpunit.xsd"
5-
bootstrap="tests/bootstrap.php"
5+
bootstrap="tests/Support/bootstrap.php"
66
cacheDirectory=".phpunit.cache"
77
colors="true"
88
executionOrder="depends,defects"

src/PopperAsset.php

-29
This file was deleted.

src/PopperCdnAsset.php

-32
This file was deleted.

tests/AssetTest.php

-63
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
use Yii2\Asset\BootstrapCdnAsset;
1010
use Yii2\Asset\BootstrapPluginAsset;
1111
use Yii2\Asset\BootstrapPluginCdnAsset;
12-
use Yii2\Asset\PopperAsset;
13-
use Yii2\Asset\PopperCdnAsset;
1412
use yii\web\AssetBundle;
1513
use yii\web\View;
1614

@@ -150,65 +148,4 @@ public function testBootstrapPluginCdnAssetRegister(): void
150148
$result,
151149
);
152150
}
153-
154-
public function testPopperAssetSimpleDependency(): void
155-
{
156-
$view = Yii::$app->getView();
157-
158-
$this->assertEmpty($view->assetBundles);
159-
160-
PopperAsset::register($view);
161-
162-
$this->assertCount(1, $view->assetBundles);
163-
$this->assertArrayHasKey(PopperAsset::class, $view->assetBundles);
164-
}
165-
166-
public function testPopperAssetRegister(): void
167-
{
168-
$view = new View();
169-
170-
$this->assertEmpty($view->assetBundles);
171-
172-
PopperAsset::register($view);
173-
174-
$this->assertCount(1, $view->assetBundles);
175-
$this->assertInstanceOf(AssetBundle::class, $view->assetBundles[PopperAsset::class]);
176-
177-
$result = $view->renderFile(__DIR__ . '/Support/main.php');
178-
179-
$this->assertStringContainsString('popper.js', $result);
180-
}
181-
182-
public function testPopperCdnAssetSimpleDependency(): void
183-
{
184-
$view = Yii::$app->getView();
185-
186-
$this->assertEmpty($view->assetBundles);
187-
188-
PopperCdnAsset::register($view);
189-
190-
$this->assertCount(1, $view->assetBundles);
191-
$this->assertArrayHasKey(PopperCdnAsset::class, $view->assetBundles);
192-
}
193-
194-
public function testPopperCdnAssetRegister(): void
195-
{
196-
$view = new View();
197-
198-
$this->assertEmpty($view->assetBundles);
199-
200-
PopperCdnAsset::register($view);
201-
202-
$this->assertCount(1, $view->assetBundles);
203-
$this->assertInstanceOf(AssetBundle::class, $view->assetBundles[PopperCdnAsset::class]);
204-
205-
$result = $view->renderFile(__DIR__ . '/Support/main.php');
206-
207-
$this->assertStringContainsString(
208-
<<<HTML
209-
<script src="https://cdn.jsdelivr.net/npm/@popperjs/[email protected]/dist/umd/popper.min.js" crossorigin="anonymous" integrity="sha384-I7E8VVD/ismYTF4hNIPjVp/Zjvgyol6VFvRkX/vR+Vc4jQkC+hVqc2pM8ODewa9r"></script>
210-
HTML,
211-
$result,
212-
);
213-
}
214151
}

tests/bootstrap.php renamed to tests/Support/bootstrap.php

+3-4
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44

55
define('YII_ENV', 'test');
66

7-
$autoload = dirname(__DIR__) . '/vendor/autoload.php';
8-
$yii2 = dirname(__DIR__) . '/vendor/yiisoft/yii2/Yii.php';
7+
$root = dirname(__DIR__, 2);
8+
$autoload = $root . '/vendor/autoload.php';
9+
$yii2 = $root . '/vendor/yiisoft/yii2/Yii.php';
910

1011
if (!is_file($autoload)) {
1112
die('You need to set up the project dependencies using Composer');
@@ -17,5 +18,3 @@
1718

1819
require_once $autoload;
1920
require_once $yii2;
20-
21-
Yii::setAlias('@root', dirname(__DIR__));

0 commit comments

Comments
 (0)