Skip to content

Commit c7af5e4

Browse files
committed
添加.travis
1 parent d755f98 commit c7af5e4

File tree

3 files changed

+60
-1
lines changed

3 files changed

+60
-1
lines changed

.travis.yml

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
language: php
2+
php:
3+
- 7.1
4+
before_script:
5+
- composer install
6+
7+
script:
8+
- vendor/bin/phpunit tests/TranslateTest

composer.json

+6-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,12 @@
2525
},
2626
"autoload": {
2727
"psr-4": {
28-
" ShaoZeMing\\LaravelTranslate\\": "src/"
28+
" ShaoZeMing\\LaravelTranslate\\": "./src/"
29+
}
30+
},
31+
"autoload-dev": {
32+
"psr-4": {
33+
"ShaoZeMing\\LaravelTranslate\\Test\\": "./tests/"
2934
}
3035
},
3136
"minimum-stability":"dev"

tests/TranslateTest.php

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
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+
}

0 commit comments

Comments
 (0)