diff --git a/README.md b/README.md index a1f5022..5806b9f 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ -

Asset for Twitter Bootstrap 5.

+

Asset bundle for Twitter Bootstrap 5.


@@ -42,7 +42,7 @@ or add to the require-dev section of your `composer.json` file. -## Usage +## Basic usage ```php css = $assetPopper; - $this->publishOptions['only'] = array_merge($assetPopper, $assetPopperMap); - } -} diff --git a/src/PopperCdnAsset.php b/src/PopperCdnAsset.php deleted file mode 100644 index fa02f1e..0000000 --- a/src/PopperCdnAsset.php +++ /dev/null @@ -1,32 +0,0 @@ - - */ - public $js = [ - 'https://cdn.jsdelivr.net/npm/@popperjs/core@2.11.8/dist/umd/popper.min.js', - ]; - - /** - * @inheritDoc - * - * @phpstan-var array - */ - public $jsOptions = [ - 'crossorigin' => 'anonymous', - 'integrity' => 'sha384-I7E8VVD/ismYTF4hNIPjVp/Zjvgyol6VFvRkX/vR+Vc4jQkC+hVqc2pM8ODewa9r', - ]; -} diff --git a/tests/AssetTest.php b/tests/AssetTest.php index ae6efdd..d5f5b90 100644 --- a/tests/AssetTest.php +++ b/tests/AssetTest.php @@ -9,8 +9,6 @@ use Yii2\Asset\BootstrapCdnAsset; use Yii2\Asset\BootstrapPluginAsset; use Yii2\Asset\BootstrapPluginCdnAsset; -use Yii2\Asset\PopperAsset; -use Yii2\Asset\PopperCdnAsset; use yii\web\AssetBundle; use yii\web\View; @@ -150,65 +148,4 @@ public function testBootstrapPluginCdnAssetRegister(): void $result, ); } - - public function testPopperAssetSimpleDependency(): void - { - $view = Yii::$app->getView(); - - $this->assertEmpty($view->assetBundles); - - PopperAsset::register($view); - - $this->assertCount(1, $view->assetBundles); - $this->assertArrayHasKey(PopperAsset::class, $view->assetBundles); - } - - public function testPopperAssetRegister(): void - { - $view = new View(); - - $this->assertEmpty($view->assetBundles); - - PopperAsset::register($view); - - $this->assertCount(1, $view->assetBundles); - $this->assertInstanceOf(AssetBundle::class, $view->assetBundles[PopperAsset::class]); - - $result = $view->renderFile(__DIR__ . '/Support/main.php'); - - $this->assertStringContainsString('popper.js', $result); - } - - public function testPopperCdnAssetSimpleDependency(): void - { - $view = Yii::$app->getView(); - - $this->assertEmpty($view->assetBundles); - - PopperCdnAsset::register($view); - - $this->assertCount(1, $view->assetBundles); - $this->assertArrayHasKey(PopperCdnAsset::class, $view->assetBundles); - } - - public function testPopperCdnAssetRegister(): void - { - $view = new View(); - - $this->assertEmpty($view->assetBundles); - - PopperCdnAsset::register($view); - - $this->assertCount(1, $view->assetBundles); - $this->assertInstanceOf(AssetBundle::class, $view->assetBundles[PopperCdnAsset::class]); - - $result = $view->renderFile(__DIR__ . '/Support/main.php'); - - $this->assertStringContainsString( - << - HTML, - $result, - ); - } } diff --git a/tests/bootstrap.php b/tests/Support/bootstrap.php similarity index 64% rename from tests/bootstrap.php rename to tests/Support/bootstrap.php index ed7d498..192133b 100644 --- a/tests/bootstrap.php +++ b/tests/Support/bootstrap.php @@ -4,8 +4,9 @@ define('YII_ENV', 'test'); -$autoload = dirname(__DIR__) . '/vendor/autoload.php'; -$yii2 = dirname(__DIR__) . '/vendor/yiisoft/yii2/Yii.php'; +$root = dirname(__DIR__, 2); +$autoload = $root . '/vendor/autoload.php'; +$yii2 = $root . '/vendor/yiisoft/yii2/Yii.php'; if (!is_file($autoload)) { die('You need to set up the project dependencies using Composer'); @@ -17,5 +18,3 @@ require_once $autoload; require_once $yii2; - -Yii::setAlias('@root', dirname(__DIR__));