Skip to content

Commit

Permalink
update test readme (swoole#3345)
Browse files Browse the repository at this point in the history
  • Loading branch information
sy-records authored May 24, 2020
1 parent 7216f03 commit 89c4617
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ Run `./clean` to remove all of the tests log files.
## Contribute the test script
Run `./new [test-script-filename]`

E.g. : `./new ./swoole-coroutine/co_sleep.phpt`
E.g. : `./new ./swoole_coroutine/co_sleep.phpt`

It will generate the test script file and auto open on your ide (MacOS only).

![](https://ws1.sinaimg.cn/large/006DQdzWly1frvn56azn9g30rs0m8b29.gif)
![](https://cdn.jsdelivr.net/gh/sy-records/staticfile/images/swoole/generate-example.gif)
8 changes: 4 additions & 4 deletions tests/new
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ if (!pathinfo($filename, PATHINFO_EXTENSION)) {
$path['dirname'] = trim($path['dirname'], './'); // i know arg2 is a list but it's no problem

$replacement = [];
$tip = swoole_color("[Test name]: ", SWOOLE_COLOR_BLUE);
$tip = swoole_color("[Test name]", SWOOLE_COLOR_BLUE);
$path['filename'] = fgetsin($tip, false);// use test name to be filename
$tip = swoole_color("[Test intro]: ", SWOOLE_COLOR_BLUE);
$tip = swoole_color("[Test intro]", SWOOLE_COLOR_BLUE);
$replacement['test_intro'] = fgetsin($tip, false);
$this_dir_name = explode('/', $path['dirname']);
$replacement['test_name'] = end($this_dir_name); // use dir name to be test name
Expand Down Expand Up @@ -100,14 +100,14 @@ if (file_put_contents($filename, $template)) {
@shell_exec('/usr/bin/env git add ' . __DIR__ . "/$filename");
if (\stripos(PHP_OS, 'Darwin') !== false) {
//MacOS
$pstorm = '/usr/local/bin/pstorm';
$pstorm = '/usr/local/bin/phpstorm';
if (file_exists($pstorm) || (
file_exists('/Applications/PhpStorm.app') &&
file_put_contents($pstorm, file_get_contents(__DIR__ . '/include/macos/phpstorm.py')) &&
chmod($pstorm, 0744)
)
) {
@shell_exec("/usr/local/bin/phpstorm {$filename}");
@shell_exec("{$pstorm} {$filename}");
}
}
} else {
Expand Down

0 comments on commit 89c4617

Please sign in to comment.