phpデバッグ環境構築
This commit is contained in:
parent
4de0ac94f2
commit
bee2265fc6
89
.vscode/settings.json
vendored
Normal file
89
.vscode/settings.json
vendored
Normal file
@ -0,0 +1,89 @@
|
||||
{
|
||||
"intelephense.environment.phpVersion": "7.4.19",
|
||||
"intelephense.stubs": [
|
||||
"apache",
|
||||
"bcmath",
|
||||
"bz2",
|
||||
"calendar",
|
||||
"com_dotnet",
|
||||
"Core",
|
||||
"ctype",
|
||||
"curl",
|
||||
"date",
|
||||
"dba",
|
||||
"dom",
|
||||
"enchant",
|
||||
"exif",
|
||||
"FFI",
|
||||
"fileinfo",
|
||||
"filter",
|
||||
"fpm",
|
||||
"ftp",
|
||||
"gd",
|
||||
"gettext",
|
||||
"gmp",
|
||||
"hash",
|
||||
"iconv",
|
||||
"imap",
|
||||
"intl",
|
||||
"json",
|
||||
"ldap",
|
||||
"libxml",
|
||||
"mbstring",
|
||||
"meta",
|
||||
"mysqli",
|
||||
"oci8",
|
||||
"odbc",
|
||||
"openssl",
|
||||
"pcntl",
|
||||
"pcre",
|
||||
"PDO",
|
||||
"pdo_ibm",
|
||||
"pdo_mysql",
|
||||
"pdo_pgsql",
|
||||
"pdo_sqlite",
|
||||
"pgsql",
|
||||
"Phar",
|
||||
"posix",
|
||||
"pspell",
|
||||
"random",
|
||||
"readline",
|
||||
"Reflection",
|
||||
"session",
|
||||
"shmop",
|
||||
"SimpleXML",
|
||||
"snmp",
|
||||
"soap",
|
||||
"sockets",
|
||||
"sodium",
|
||||
"SPL",
|
||||
"sqlite3",
|
||||
"standard",
|
||||
"superglobals",
|
||||
"sysvmsg",
|
||||
"sysvsem",
|
||||
"sysvshm",
|
||||
"tidy",
|
||||
"tokenizer",
|
||||
"xml",
|
||||
"xmlreader",
|
||||
"xmlrpc",
|
||||
"xmlwriter",
|
||||
"xsl",
|
||||
"Zend OPcache",
|
||||
"zip",
|
||||
"zlib",
|
||||
"yaml"
|
||||
],
|
||||
"intelephense.phpdoc.classTemplate": {
|
||||
|
||||
"summary": "$1",
|
||||
"tags": [
|
||||
"@package ${1:$SYMBOL_NAMESPACE}"
|
||||
]
|
||||
},
|
||||
"php.stubs": [
|
||||
"*",
|
||||
"yaml"
|
||||
]
|
||||
}
|
15
README.md
15
README.md
@ -12,3 +12,18 @@ lisence : MIT
|
||||
|
||||
* OpenAPIを読み込みMD形式のテストケースに変換する
|
||||
* YAMLファイルを読み込む機能
|
||||
|
||||
|
||||
## init
|
||||
|
||||
```
|
||||
docker-compose up -d --build
|
||||
docker exec -it php-xdebug bash
|
||||
```
|
||||
|
||||
## exec
|
||||
|
||||
|
||||
```
|
||||
php index.php
|
||||
```
|
||||
|
@ -2,6 +2,7 @@ FROM php:7.4-apache
|
||||
|
||||
|
||||
RUN apt-get update && apt-get install -y \
|
||||
libyaml-dev \
|
||||
vim \
|
||||
zip \
|
||||
unzip
|
||||
@ -10,7 +11,11 @@ RUN apt-get update && apt-get install -y \
|
||||
RUN cd /usr/bin && curl -s http://getcomposer.org/installer | php && ln -s /usr/bin/composer.phar /usr/bin/composer
|
||||
|
||||
|
||||
|
||||
# install xdebug
|
||||
RUN pecl install xdebug-2.9.8 \
|
||||
&& docker-php-ext-enable xdebug
|
||||
|
||||
# install yaml
|
||||
RUN pecl install yaml \
|
||||
&& docker-php-ext-enable yaml
|
||||
|
9
src/app/classes/TestCase.php
Normal file
9
src/app/classes/TestCase.php
Normal file
@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
|
||||
class TestCase{
|
||||
|
||||
public string $type;
|
||||
public string $title;
|
||||
|
||||
}
|
@ -2,17 +2,69 @@
|
||||
$timer_start = microtime(true);// 実行開始速度
|
||||
require __DIR__ . '/vendor/autoload.php';
|
||||
|
||||
/**
|
||||
* load_yaml_file
|
||||
*
|
||||
* yamlファイルを読み込む関数
|
||||
*
|
||||
* @param string $filename
|
||||
* @return false | mixed
|
||||
*/
|
||||
function load_yaml_file(string $filename){
|
||||
$result = yaml_parse_file($filename);
|
||||
return $result;
|
||||
#$input = file_get_contents($filename);
|
||||
#$result = \Symfony\Component\Yaml\Yaml::parse($input);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* set_yaml2testcase
|
||||
*
|
||||
* yamlからテストケースオブジェクトを生成する
|
||||
*
|
||||
* @param array $ymal
|
||||
* @return void
|
||||
*/
|
||||
function set_yaml2testcase($yaml){
|
||||
echo '-------------------------------'.PHP_EOL;
|
||||
echo 'openapi='.$yaml['openapi'].PHP_EOL;
|
||||
foreach($yaml['paths'] as $path => $data){
|
||||
// パラメータのテストケース
|
||||
|
||||
// echo 'openapi='.$yaml['openapi'].PHP_EOL;
|
||||
|
||||
// getの場合のテストケース
|
||||
// echo 'openapi='.$yaml['openapi'].PHP_EOL;
|
||||
|
||||
// post・putの場合のテストケース
|
||||
// echo 'openapi='.$yaml['openapi'].PHP_EOL;
|
||||
|
||||
// deleteの場合のテストケース
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
# echo 'path='.$yaml['paths'][0][0].PHP_EOL;
|
||||
echo '-------------------------------'.PHP_EOL;
|
||||
return ;
|
||||
}
|
||||
|
||||
|
||||
$filename = 'openapi.yaml';
|
||||
$yaml = yaml_parse_file($filename);
|
||||
|
||||
if(!$yaml){
|
||||
print 'ERROR Purse OpenApiFile'.PHP_EOL ;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
$input = file_get_contents($filename);
|
||||
$result = \Symfony\Component\Yaml\Yaml::parse($input);
|
||||
|
||||
set_yaml2testcase($yaml);
|
||||
|
||||
|
||||
|
||||
$timer_end = microtime(true);// 実行終了速度
|
||||
$timer = $timer_end - $timer_start;
|
||||
echo '実行速度:'.ceil($timer*1000)."ms: $timer";
|
||||
echo '実行速度:'.ceil($timer*1000)."ms: $timer".PHP_EOL;
|
Loading…
x
Reference in New Issue
Block a user