فهرست منبع

added yii console command to tests

Mark 12 سال پیش
والد
کامیت
58de43ef0f

+ 12 - 0
tests/_console_bootstrap.php

@@ -0,0 +1,12 @@
+<?php
+
+defined('YII_DEBUG') or define('YII_DEBUG', true);
+
+defined('YII_ENV') or define('YII_ENV', 'test');
+
+// fcgi doesn't have STDIN and STDOUT defined by default
+defined('STDIN') or define('STDIN', fopen('php://stdin', 'r'));
+defined('STDOUT') or define('STDOUT', fopen('php://stdout', 'w'));
+
+require(__DIR__ . '/../vendor/autoload.php');
+require(__DIR__ . '/../vendor/yiisoft/yii2/Yii.php');

+ 13 - 0
tests/acceptance/_console.php

@@ -0,0 +1,13 @@
+<?php
+
+return yii\helpers\ArrayHelper::merge(
+	require(__DIR__ . '/../../config/console.php'),
+	require(__DIR__ . '/../_config.php'),
+	[
+		'components' => [
+			'db' => [
+				'dsn' => 'mysql:host=localhost;dbname=yii2_basic_acceptance',
+			],
+		],
+	]
+);

+ 17 - 0
tests/acceptance/yii

@@ -0,0 +1,17 @@
+#!/usr/bin/env php
+<?php
+/**
+ * Yii console bootstrap file.
+ *
+ * @link http://www.yiiframework.com/
+ * @copyright Copyright (c) 2008 Yii Software LLC
+ * @license http://www.yiiframework.com/license/
+ */
+
+require_once __DIR__ . '/../_console_bootstrap.php';
+
+$config = require(__DIR__ . '/_console.php');
+
+$application = new yii\console\Application($config);
+$exitCode = $application->run();
+exit($exitCode);

+ 20 - 0
tests/acceptance/yii.bat

@@ -0,0 +1,20 @@
+@echo off
+
+rem -------------------------------------------------------------
+rem  Yii command line bootstrap script for Windows.
+rem
+rem  @author Qiang Xue <qiang.xue@gmail.com>
+rem  @link http://www.yiiframework.com/
+rem  @copyright Copyright &copy; 2012 Yii Software LLC
+rem  @license http://www.yiiframework.com/license/
+rem -------------------------------------------------------------
+
+@setlocal
+
+set YII_PATH=%~dp0
+
+if "%PHP_COMMAND%" == "" set PHP_COMMAND=php.exe
+
+"%PHP_COMMAND%" "%YII_PATH%yii" %*
+
+@endlocal

+ 13 - 0
tests/functional/_console.php

@@ -0,0 +1,13 @@
+<?php
+
+return yii\helpers\ArrayHelper::merge(
+	require(__DIR__ . '/../../config/console.php'),
+	require(__DIR__ . '/../_config.php'),
+	[
+		'components' => [
+			'db' => [
+				'dsn' => 'mysql:host=localhost;dbname=yii2_basic_functional',
+			],
+		],
+	]
+);

+ 17 - 0
tests/functional/yii

@@ -0,0 +1,17 @@
+#!/usr/bin/env php
+<?php
+/**
+ * Yii console bootstrap file.
+ *
+ * @link http://www.yiiframework.com/
+ * @copyright Copyright (c) 2008 Yii Software LLC
+ * @license http://www.yiiframework.com/license/
+ */
+
+require_once __DIR__ . '/../_console_bootstrap.php';
+
+$config = require(__DIR__ . '/_console.php');
+
+$application = new yii\console\Application($config);
+$exitCode = $application->run();
+exit($exitCode);

+ 20 - 0
tests/functional/yii.bat

@@ -0,0 +1,20 @@
+@echo off
+
+rem -------------------------------------------------------------
+rem  Yii command line bootstrap script for Windows.
+rem
+rem  @author Qiang Xue <qiang.xue@gmail.com>
+rem  @link http://www.yiiframework.com/
+rem  @copyright Copyright &copy; 2012 Yii Software LLC
+rem  @license http://www.yiiframework.com/license/
+rem -------------------------------------------------------------
+
+@setlocal
+
+set YII_PATH=%~dp0
+
+if "%PHP_COMMAND%" == "" set PHP_COMMAND=php.exe
+
+"%PHP_COMMAND%" "%YII_PATH%yii" %*
+
+@endlocal

+ 13 - 0
tests/unit/_console.php

@@ -0,0 +1,13 @@
+<?php
+
+return yii\helpers\ArrayHelper::merge(
+	require(__DIR__ . '/../../config/console.php'),
+	require(__DIR__ . '/../_config.php'),
+	[
+		'components' => [
+			'db' => [
+				'dsn' => 'mysql:host=localhost;dbname=yii2_basic_unit',
+			],
+		],
+	]
+);

+ 17 - 0
tests/unit/yii

@@ -0,0 +1,17 @@
+#!/usr/bin/env php
+<?php
+/**
+ * Yii console bootstrap file.
+ *
+ * @link http://www.yiiframework.com/
+ * @copyright Copyright (c) 2008 Yii Software LLC
+ * @license http://www.yiiframework.com/license/
+ */
+
+require_once __DIR__ . '/../_console_bootstrap.php';
+
+$config = require(__DIR__ . '/_console.php');
+
+$application = new yii\console\Application($config);
+$exitCode = $application->run();
+exit($exitCode);

+ 20 - 0
tests/unit/yii.bat

@@ -0,0 +1,20 @@
+@echo off
+
+rem -------------------------------------------------------------
+rem  Yii command line bootstrap script for Windows.
+rem
+rem  @author Qiang Xue <qiang.xue@gmail.com>
+rem  @link http://www.yiiframework.com/
+rem  @copyright Copyright &copy; 2012 Yii Software LLC
+rem  @license http://www.yiiframework.com/license/
+rem -------------------------------------------------------------
+
+@setlocal
+
+set YII_PATH=%~dp0
+
+if "%PHP_COMMAND%" == "" set PHP_COMMAND=php.exe
+
+"%PHP_COMMAND%" "%YII_PATH%yii" %*
+
+@endlocal