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 19
19
],
20
20
"require" : {
21
21
"ext-json" : " *" ,
22
- "php" : " ^ 7.2" ,
22
+ "php" : " >= 7.2" ,
23
23
"guzzlehttp/guzzle" : " ^7.3"
24
24
},
25
25
"autoload" : {
26
26
"psr-4" : {
27
27
"ALAPI\\ " : " src"
28
28
}
29
29
},
30
+ "autoload-dev" : {
31
+ "psr-4" : {
32
+ "ALAPI\\ Tests\\ " : " tests"
33
+ }
34
+ },
30
35
"require-dev" : {
31
- "friendsofphp/php-cs-fixer" : " ^3.0"
36
+ "friendsofphp/php-cs-fixer" : " ^3.0" ,
37
+ "phpunit/phpunit" : " ^7.5"
32
38
}
33
39
}
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
+
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