Skip to content

Commit

Permalink
clean test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
yndu13 committed Sep 3, 2024
1 parent 8e6d69f commit 2fea0b7
Show file tree
Hide file tree
Showing 166 changed files with 308 additions and 11,345 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,19 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: ['7.2', '7.3', '7.4', '8.0', '8.1']
php-versions: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2']
fail-fast: false

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

- uses: actions/setup-node@v1
- uses: actions/setup-node@v4
with:
node-version: 10.x

- name: Install Proxy
run: npm install o_o -g --registry=https://registry.npm.taobao.org
run: npm install o_o -g --registry=https://registry.npmmirror.com

- name: Start Proxy
run: o_o &
Expand All @@ -44,7 +45,7 @@ jobs:
run: composer install --prefer-dist --no-progress --no-suggest

- name: Run test case
run: composer test4HighVersion
run: composer test
env:
REGION_ID: ${{ secrets.REGION_ID }}
ACCESS_KEY_ID: ${{ secrets.ACCESS_KEY_ID }}
Expand Down
59 changes: 0 additions & 59 deletions .github/workflows/ci_lower_than_php7.2.yml

This file was deleted.

24 changes: 4 additions & 20 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,29 +97,13 @@
"test": [
"phpunit --colors=always"
],
"test4HighVersion": [
"unit": [
"@clearCache",
"phpunit --testsuite=Test4HighVersion --colors=always"
"phpunit --testsuite=Unit --colors=always"
],
"test4LowVersion": [
"feature": [
"@clearCache",
"phpunit --testsuite=Test4LowVersion --colors=always"
],
"unit4HighVersion": [
"@clearCache",
"phpunit --testsuite=Unit4HighVersion --colors=always"
],
"unit4LowVersion": [
"@clearCache",
"phpunit --testsuite=Unit4LowVersion --colors=always"
],
"feature4HighVersion": [
"@clearCache",
"phpunit --testsuite=Feature4HighVersion --colors=always"
],
"feature4LowVersion": [
"@clearCache",
"phpunit --testsuite=Feature4LowVersion --colors=always"
"phpunit --testsuite=Feature --colors=always"
],
"coverage": "open cache/coverage/index.html",
"clearCache": "rm -rf cache/*",
Expand Down
23 changes: 6 additions & 17 deletions phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,15 @@
<testsuite name="All">
<directory>tests</directory>
</testsuite>
<testsuite name="Test4HighVersion">
<directory>./tests/HigherthanorEqualtoVersion7_2</directory>
<testsuite name="Test">
<directory>./tests</directory>
</testsuite>
<testsuite name="Test4LowVersion">
<directory>./tests/LowerthanVersion7_2</directory>
</testsuite>
<testsuite name="Unit4HighVersion">
<directory suffix="Test.php">./tests/HigherthanorEqualtoVersion7_2/Unit</directory>
</testsuite>

<testsuite name="Feature4HighVersion">
<directory suffix="Test.php">./tests/HigherthanorEqualtoVersion7_2/Feature</directory>
</testsuite>

<testsuite name="Unit4LowVersion">
<directory suffix="Test.php">./tests/LowerthanVersion7_2/Unit</directory>
<testsuite name="Unit">
<directory suffix="Test.php">./tests/Unit</directory>
</testsuite>

<testsuite name="Feature4LowVersion">
<directory suffix="Test.php">./tests/LowerthanVersion7_2/Feature</directory>
<testsuite name="Feature">
<directory suffix="Test.php">./tests/Feature</directory>
</testsuite>
</testsuites>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace AlibabaCloud\Client\Tests\HigherthanorEqualtoVersion7_2\Feature\Credentials;
namespace AlibabaCloud\Client\Tests\Feature\Credentials;

use PHPUnit\Framework\TestCase;
use AlibabaCloud\Client\AlibabaCloud;
Expand All @@ -14,7 +14,7 @@
/**
* Class AccessKeyCredentialTest
*
* @package AlibabaCloud\Client\Tests\HigherthanorEqualtoVersion7_2\Feature\Credentials
* @package AlibabaCloud\Client\Tests\Feature\Credentials
*/
class AccessKeyCredentialTest extends TestCase
{
Expand All @@ -25,10 +25,12 @@ class AccessKeyCredentialTest extends TestCase
private $clientName = 'AccessKeyCredentialTest';

/**
* @before
* @throws ClientException
*/
public function setUp(): void
public function initialize()
{
parent::setUp();
$regionId = 'cn-hangzhou';
$accessKeyId = \getenv('ACCESS_KEY_ID');
$accessKeySecret = \getenv('ACCESS_KEY_SECRET');
Expand All @@ -38,10 +40,12 @@ public function setUp(): void
}

/**
* @after
* @throws ClientException
*/
public function tearDown(): void
public function finalize()
{
parent::tearDown();
AlibabaCloud::del($this->clientName);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace AlibabaCloud\Client\Tests\HigherthanorEqualtoVersion7_2\Feature\Credentials;
namespace AlibabaCloud\Client\Tests\Feature\Credentials;

use PHPUnit\Framework\TestCase;
use AlibabaCloud\Client\AlibabaCloud;
Expand All @@ -13,7 +13,7 @@
/**
* Class BearerTokenCredentialTest
*
* @package AlibabaCloud\Client\Tests\HigherthanorEqualtoVersion7_2\Feature\Credentials
* @package AlibabaCloud\Client\Tests\Feature\Credentials
*/
class BearerTokenCredentialTest extends TestCase
{
Expand All @@ -24,10 +24,12 @@ class BearerTokenCredentialTest extends TestCase
protected $clientName = 'BearerTokenCredentialTest';

/**
* @before
* @throws ClientException
*/
public function setUp(): void
public function initialize()
{
parent::setUp();
$regionId = 'cn-hangzhou';
$bearerToken =
'eyJhbGciOiJSUzI1NiIsImsyaWQiOiJlNE92NnVOUDhsMEY2RmVUMVhvek5wb1NBcVZLblNGRyIsImtpZCI6IkpDOXd4enJocUowZ3RhQ0V0MlFMVWZldkVVSXdsdEZodWk0TzFiaDY3dFUifQ.N3plS0w2cm83YzhtVzJqSkI0U0JIMldzNW45cFBOSWdNellvQ3VpZGV5NzRVOHNsMkJUWTVULzl3RDdkbzhHQkorM3dvclg1SGY1STZXL1FjaVhLVnc5ck5YeVNYanBuK2N6UkN1SnRRc3FRMGJIVTF4cVVjUDVRNUJpK2JsSWxZdlowZ2VWSzYvS2pzcVNjWHJLSlVvWkNnWE0wWGJZZ0NCVm1BUlNXS1plUnNzdnAvUmwwV01tSFFkWmlOMGtKV0o5TllQU3M0QU1aenpHVTdUY1BnYlhIVy9uTmdMY1JVSytROXlrPQ.kvZes7-6IU-xjOzK1goPPjODz1XLt73yCmDLSpRwzlz3d9A_uYvbQK0HHltVKo0K0dI0wJOfpCeOHJlrV0m4RI4bynL9ltl31rscPhQ-G4Ybqw4KXVBZCIzjSqzWcniIWnGWl-TpOy0Y7sAcJmp0Lg2ndu_shGqiTP6DTVBNV8f94mveHmRqouLxr2OKMvCyxTV1zUEJmC-JnZaljfNG-i483qG8Hm60CwAjM91FTGib3eXGzjJa3XOOY7zpZTrvahBYFpyrVhRuvDvRs6tLKVAL_7bYwCIo_tdh9rhRmFtyq0k2iykZQJmAIlDMt-VENP7hJTH62uUQzNLQ28ISTQ';
Expand All @@ -37,10 +39,12 @@ public function setUp(): void
}

/**
* @after
* @throws ClientException
*/
public function tearDown(): void
public function finalize()
{
parent::tearDown();
AlibabaCloud::del($this->clientName);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace AlibabaCloud\Client\Tests\HigherthanorEqualtoVersion7_2\Feature\Credentials;
namespace AlibabaCloud\Client\Tests\Feature\Credentials;

use PHPUnit\Framework\TestCase;
use AlibabaCloud\Client\AlibabaCloud;
Expand All @@ -11,7 +11,7 @@
/**
* Class EcsRamRoleCredentialTest
*
* @package AlibabaCloud\Client\Tests\HigherthanorEqualtoVersion7_2\Feature\Credentials
* @package AlibabaCloud\Client\Tests\Feature\Credentials
*/
class EcsRamRoleCredentialTest extends TestCase
{
Expand All @@ -25,10 +25,12 @@ class EcsRamRoleCredentialTest extends TestCase
* Sets up the fixture, for example, open a network connection.
* This method is called before a test is executed.
*
* @before
* @throws ClientException
*/
public function setUp(): void
public function initialize()
{
parent::setUp();
$regionId = 'cn-hangzhou';
$roleName = 'EcsRamRoleTest';
AlibabaCloud::ecsRamRoleClient($roleName)
Expand All @@ -40,10 +42,12 @@ public function setUp(): void
* Tears down the fixture, for example, close a network connection.
* This method is called after a test is executed.
*
* @after
* @throws ClientException
*/
public function tearDown(): void
public function finalize()
{
parent::tearDown();
AlibabaCloud::del($this->clientName);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,26 +1,37 @@
<?php

namespace AlibabaCloud\Client\Tests\HigherthanorEqualtoVersion7_2\Feature\Credentials;
namespace AlibabaCloud\Client\Tests\Feature\Credentials;

use PHPUnit\Framework\TestCase;
use AlibabaCloud\Client\AlibabaCloud;
use AlibabaCloud\Client\Exception\ClientException;
use AlibabaCloud\Client\Credentials\Ini\IniCredential;
use AlibabaCloud\Client\Tests\HigherthanorEqualtoVersion7_2\Unit\Credentials\Ini\VirtualAccessKeyCredential;
use AlibabaCloud\Client\Tests\HigherthanorEqualtoVersion7_2\Unit\Credentials\Ini\VirtualRamRoleArnCredential;
use AlibabaCloud\Client\Tests\HigherthanorEqualtoVersion7_2\Unit\Credentials\Ini\VirtualRsaKeyPairCredential;
use AlibabaCloud\Client\Tests\HigherthanorEqualtoVersion7_2\Unit\Credentials\Ini\VirtualEcsRamRoleCredential;
use AlibabaCloud\Client\Tests\HigherthanorEqualtoVersion7_2\Unit\Credentials\Ini\VirtualBearerTokenCredential;
use AlibabaCloud\Client\Tests\Unit\Credentials\Ini\VirtualAccessKeyCredential;
use AlibabaCloud\Client\Tests\Unit\Credentials\Ini\VirtualRamRoleArnCredential;
use AlibabaCloud\Client\Tests\Unit\Credentials\Ini\VirtualRsaKeyPairCredential;
use AlibabaCloud\Client\Tests\Unit\Credentials\Ini\VirtualEcsRamRoleCredential;
use AlibabaCloud\Client\Tests\Unit\Credentials\Ini\VirtualBearerTokenCredential;

/**
* Class IniCredentialFeatureTest
*
* @package AlibabaCloud\Client\Tests\HigherthanorEqualtoVersion7_2\Feature\Credentials
* @package AlibabaCloud\Client\Tests\Feature\Credentials
*
* @coversDefaultClass \AlibabaCloud\Client\Credentials\Ini\IniCredential
*/
class IniCredentialFeatureTest extends TestCase
{
/**
* @after
* @throws ClientException
*/
public function finalize()
{
parent::tearDown();
AlibabaCloud::del('phpunit');
IniCredential::forgetLoadedCredentialsFile();
}


public function testBadFormat()
{
Expand Down Expand Up @@ -85,15 +96,6 @@ public function testNoSecret()
AlibabaCloud::load(VirtualAccessKeyCredential::noSecret());
}

/**
* @throws ClientException
*/
public function tearDown(): void
{
AlibabaCloud::del('phpunit');
IniCredential::forgetLoadedCredentialsFile();
}

/**
* @throws ClientException
*/
Expand Down
Loading

0 comments on commit 2fea0b7

Please sign in to comment.