File tree Expand file tree Collapse file tree 7 files changed +105
-10
lines changed Expand file tree Collapse file tree 7 files changed +105
-10
lines changed Original file line number Diff line number Diff line change @@ -103,7 +103,7 @@ class OptionalPackages
103
103
*/
104
104
private $ stabilityFlags ;
105
105
106
- public function __construct (IOInterface $ io , Composer $ composer , string $ projectRoot = null )
106
+ public function __construct (IOInterface $ io , Composer $ composer , ? string $ projectRoot = null )
107
107
{
108
108
$ this ->io = $ io ;
109
109
$ this ->composer = $ composer ;
@@ -139,11 +139,13 @@ function ($value) {
139
139
'n '
140
140
);
141
141
142
- if ($ answer != 'n ' ) {
143
- $ content = file_get_contents ($ this ->installerSource . '/resources/bin/hyperf.stub ' );
144
- $ content = str_replace ('%TIME_ZONE% ' , $ answer , $ content );
145
- file_put_contents ($ this ->projectRoot . '/bin/hyperf.php ' , $ content );
142
+ if ($ answer == 'n ' ) {
143
+ $ answer = date_default_timezone_get ();
146
144
}
145
+
146
+ $ content = file_get_contents ($ this ->installerSource . '/resources/bin/hyperf.stub ' );
147
+ $ content = str_replace ('%TIME_ZONE% ' , $ answer , $ content );
148
+ file_put_contents ($ this ->projectRoot . '/bin/hyperf.php ' , $ content );
147
149
}
148
150
149
151
/**
Original file line number Diff line number Diff line change 71
71
'hyperf/service-governance ' => [
72
72
'version ' => '~3.1.0 ' ,
73
73
],
74
+ 'pestphp/pest ' => [
75
+ 'version ' => '^2.34 ' ,
76
+ ],
74
77
],
75
78
'require-dev ' => [
79
+ 'pestphp/pest ' ,
76
80
],
77
81
'questions ' => [
78
82
'database ' => [
310
314
],
311
315
],
312
316
],
317
+ 'pest ' => [
318
+ 'question ' => 'Do you want to use pestphp/pest component ? (Pest is a testing framework with a focus on simplicity,
319
+ meticulously designed to bring back the joy of testing in PHP.) ' ,
320
+ 'default ' => 'n ' ,
321
+ 'required ' => false ,
322
+ 'force ' => true ,
323
+ 'custom-package ' => true ,
324
+ 'options ' => [
325
+ 'y ' => [
326
+ 'name ' => 'yes ' ,
327
+ 'packages ' => [
328
+ 'pestphp/pest ' ,
329
+ ],
330
+ 'resources ' => [
331
+ 'resources/pest/Feature/ExampleTest.php ' => 'test/Feature/ExampleTest.php ' ,
332
+ 'resources/pest/Unit/ExampleTest.php ' => 'test/Unit/ExampleTest.php ' ,
333
+ 'resources/pest/Pest.php ' => 'test/Pest.php ' ,
334
+ 'resources/pest/TestCase.php ' => 'test/TestCase.php ' ,
335
+ ],
336
+ ],
337
+ ],
338
+ ],
313
339
],
314
340
];
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ test ('example ' , function () {
4
+ expect (true )->toBeTrue ();
5
+ });
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ /*
4
+ |--------------------------------------------------------------------------
5
+ | Test Case
6
+ |--------------------------------------------------------------------------
7
+ |
8
+ | The closure you provide to your test functions is always bound to a specific PHPUnit test
9
+ | case class. By default, that class is "PHPUnit\Framework\TestCase". Of course, you may
10
+ | need to change it using the "uses()" function to bind a different classes or traits.
11
+ |
12
+ */
13
+
14
+ // uses(Tests\TestCase::class)->in('Feature');
15
+
16
+ /*
17
+ |--------------------------------------------------------------------------
18
+ | Expectations
19
+ |--------------------------------------------------------------------------
20
+ |
21
+ | When you're writing tests, you often need to check that values meet certain conditions. The
22
+ | "expect()" function gives you access to a set of "expectations" methods that you can use
23
+ | to assert different things. Of course, you may extend the Expectation API at any time.
24
+ |
25
+ */
26
+
27
+ expect ()->extend ('toBeOne ' , function () {
28
+ return $ this ->toBe (1 );
29
+ });
30
+
31
+ /*
32
+ |--------------------------------------------------------------------------
33
+ | Functions
34
+ |--------------------------------------------------------------------------
35
+ |
36
+ | While Pest is very powerful out-of-the-box, you may have some testing code specific to your
37
+ | project that you don't want to repeat in every file. Here you can also expose helpers as
38
+ | global functions to help you to reduce the number of lines of code in your test files.
39
+ |
40
+ */
41
+
42
+ function something ()
43
+ {
44
+ // ..
45
+ }
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace Tests ;
4
+
5
+ use PHPUnit \Framework \TestCase as BaseTestCase ;
6
+
7
+ abstract class TestCase extends BaseTestCase
8
+ {
9
+ //
10
+ }
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ test ('example ' , function () {
4
+ expect (true )->toBeTrue ();
5
+ });
Original file line number Diff line number Diff line change 9
9
10
10
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
11
11
*/
12
+ use Hyperf \Contract \ApplicationInterface ;
13
+ use Hyperf \Di \ClassLoader ;
14
+ use Hyperf \Engine \DefaultOption ;
15
+
12
16
ini_set ('display_errors ' , 'on ' );
13
17
ini_set ('display_startup_errors ' , 'on ' );
14
18
15
19
error_reporting (E_ALL );
16
20
date_default_timezone_set ('Asia/Shanghai ' );
17
21
18
- Swoole \Runtime::enableCoroutine (true );
19
-
20
22
! defined ('BASE_PATH ' ) && define ('BASE_PATH ' , dirname (__DIR__ , 1 ));
21
23
22
24
require BASE_PATH . '/vendor/autoload.php ' ;
23
25
24
- ! defined ('SWOOLE_HOOK_FLAGS ' ) && define ('SWOOLE_HOOK_FLAGS ' , Hyperf \ Engine \ DefaultOption::hookFlags ());
26
+ ! defined ('SWOOLE_HOOK_FLAGS ' ) && define ('SWOOLE_HOOK_FLAGS ' , DefaultOption::hookFlags ());
25
27
26
- Hyperf \ Di \ ClassLoader::init ();
28
+ ClassLoader::init ();
27
29
28
30
$ container = require BASE_PATH . '/config/container.php ' ;
29
31
30
- $ container ->get (Hyperf \ Contract \ ApplicationInterface::class);
32
+ $ container ->get (ApplicationInterface::class);
You can’t perform that action at this time.
0 commit comments