File tree 3 files changed +60
-1
lines changed
3 files changed +60
-1
lines changed Original file line number Diff line number Diff line change
1
+ language : php
2
+ php :
3
+ - 7.1
4
+ before_script :
5
+ - composer install
6
+
7
+ script :
8
+ - vendor/bin/phpunit tests/TranslateTest
Original file line number Diff line number Diff line change 25
25
},
26
26
"autoload" : {
27
27
"psr-4" : {
28
- " ShaoZeMing\\ LaravelTranslate\\ " : " src/"
28
+ " ShaoZeMing\\ LaravelTranslate\\ " : " ./src/"
29
+ }
30
+ },
31
+ "autoload-dev" : {
32
+ "psr-4" : {
33
+ "ShaoZeMing\\ LaravelTranslate\\ Test\\ " : " ./tests/"
29
34
}
30
35
},
31
36
"minimum-stability" :" dev"
Original file line number Diff line number Diff line change
1
+ <?php
2
+ /**
3
+ * TestSms.php
4
+ *
5
+
6
+ * $Id: TestSms.php 2017-08-17 上午10:08 $
7
+ */
8
+
9
+ namespace ShaoZeMing \LaravelTranslate \Test ;
10
+ use PHPUnit \Framework \TestCase ;
11
+ use ShaoZeMing \Translate \TranslateService ;
12
+
13
+
14
+ class TranslateTest extends TestCase
15
+ {
16
+ protected $ instance ;
17
+
18
+ public function setUp ()
19
+ {
20
+
21
+ $ file = dirname (__DIR__ ) .'/config/translate.php ' ;
22
+ $ config = include ($ file );
23
+ $ this ->instance = new TranslateService ($ config );
24
+ }
25
+
26
+
27
+ public function testPushManager ()
28
+ {
29
+ $ this ->assertInstanceOf (TranslateService::class, $ this ->instance );
30
+ }
31
+
32
+
33
+ public function testPush ()
34
+ {
35
+ echo PHP_EOL ."翻译中.... " .PHP_EOL ;
36
+ try {
37
+ $ result = $ this ->instance ->translate ('你知道我对你不仅仅是喜欢 ' );
38
+ print_r ($ result );
39
+ return $ result ;
40
+ } catch (\Exception $ e ) {
41
+ $ err = "Error : 错误: " . $ e ->getMessage ();
42
+ echo $ err .PHP_EOL ;
43
+
44
+ }
45
+ }
46
+ }
You can’t perform that action at this time.
0 commit comments