File tree Expand file tree Collapse file tree 4 files changed +73
-2
lines changed Expand file tree Collapse file tree 4 files changed +73
-2
lines changed Original file line number Diff line number Diff line change 1919 ],
2020 "require" : {
2121 "ext-json" : " *" ,
22- "php" : " ^ 7.2" ,
22+ "php" : " >= 7.2" ,
2323 "guzzlehttp/guzzle" : " ^7.3"
2424 },
2525 "autoload" : {
2626 "psr-4" : {
2727 "ALAPI\\ " : " src"
2828 }
2929 },
30+ "autoload-dev" : {
31+ "psr-4" : {
32+ "ALAPI\\ Tests\\ " : " tests"
33+ }
34+ },
3035 "require-dev" : {
31- "friendsofphp/php-cs-fixer" : " ^3.0"
36+ "friendsofphp/php-cs-fixer" : " ^3.0" ,
37+ "phpunit/phpunit" : " ^7.5"
3238 }
3339}
Original file line number Diff line number Diff line change 1+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2+ <phpunit backupGlobals =" false"
3+ backupStaticAttributes =" false"
4+ bootstrap =" vendor/autoload.php"
5+ colors =" true"
6+ convertErrorsToExceptions =" true"
7+ convertNoticesToExceptions =" true"
8+ convertWarningsToExceptions =" true"
9+ processIsolation =" false"
10+ stopOnFailure =" false" >
11+ <testsuites >
12+ <testsuite name =" Application Test Suite" >
13+ <directory >./tests/</directory >
14+ </testsuite >
15+ </testsuites >
16+ <filter >
17+ <whitelist >
18+ <directory suffix =" .php" >src/</directory >
19+ </whitelist >
20+ </filter >
21+ </phpunit >
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ /*
4+ * This file is part of the ALAPI-SDK/php-sdk.
5+ * (c) Alone88 <im@alone88.cn>
6+ * This source file is subject to the MIT license that is bundled
7+ * with this source code in the file LICENSE.
8+ */
9+
10+ namespace ALAPI \Tests ;
11+
12+ use ALAPI \Client ;
13+ use ALAPI \Exception \ALAPIException ;
14+ use PHPUnit \Framework \Assert ;
15+ use PHPUnit \Framework \TestCase ;
16+
17+ class ALAPITest extends TestCase
18+ {
19+ public function testAlapi ()
20+ {
21+ $ client = new Client ('token ' );
22+
23+ try {
24+ $ result = $ client ->setApi ('/api/hitokoto ' )
25+ ->setParam ('type ' , 'a ' )
26+ ->request ();
27+ Assert::assertEquals (100 , $ result ->getCode ());
28+ } catch (ALAPIException $ e ) {
29+ }
30+ }
31+
32+ public function testUpload ()
33+ {
34+ $ client = new Client ('token ' );
35+ try {
36+ $ result = $ client ->setApi ('/api/image ' )
37+ ->setParam ('image ' , 'tests/img.png ' , true )
38+ ->setParam ('type ' , 'alapi ' )
39+ ->request ();
40+ Assert::assertEquals (100 , $ result ->getCode ());
41+ } catch (ALAPIException $ e ) {
42+ }
43+ }
44+ }
You can’t perform that action at this time.
0 commit comments