Browse Source

Trait "ClientTrait" converted into "BaseClient" class.

tags/2.0.0-beta
Paul Klimov 11 years ago
parent
commit
7a4c1cd387
  1. 5
      extensions/yii/authclient/BaseClient.php
  2. 5
      extensions/yii/authclient/BaseOAuth.php
  3. 5
      extensions/yii/authclient/OpenId.php
  4. 9
      tests/unit/extensions/authclient/BaseClientTest.php
  5. 9
      tests/unit/extensions/authclient/CollectionTest.php

5
extensions/yii/authclient/ClientTrait.php → extensions/yii/authclient/BaseClient.php

@ -8,11 +8,12 @@
namespace yii\authclient; namespace yii\authclient;
use Yii; use Yii;
use yii\base\Component;
use yii\base\NotSupportedException; use yii\base\NotSupportedException;
use yii\helpers\StringHelper; use yii\helpers\StringHelper;
/** /**
* ProviderTrait can be used to satisfy [[ClientInterface]] interface. * BaseClient is a base Auth Client class.
* *
* @see ClientInterface * @see ClientInterface
* *
@ -27,7 +28,7 @@ use yii\helpers\StringHelper;
* @author Paul Klimov <klimov.paul@gmail.com> * @author Paul Klimov <klimov.paul@gmail.com>
* @since 2.0 * @since 2.0
*/ */
trait ClientTrait abstract class BaseClient extends Component implements ClientInterface
{ {
/** /**
* @var string auth service id. * @var string auth service id.

5
extensions/yii/authclient/BaseOAuth.php

@ -7,7 +7,6 @@
namespace yii\authclient; namespace yii\authclient;
use yii\base\Component;
use yii\base\Exception; use yii\base\Exception;
use yii\base\InvalidParamException; use yii\base\InvalidParamException;
use Yii; use Yii;
@ -21,10 +20,8 @@ use yii\helpers\Json;
* @author Paul Klimov <klimov.paul@gmail.com> * @author Paul Klimov <klimov.paul@gmail.com>
* @since 2.0 * @since 2.0
*/ */
abstract class BaseOAuth extends Component implements ClientInterface abstract class BaseOAuth extends BaseClient implements ClientInterface
{ {
use ClientTrait;
const CONTENT_TYPE_JSON = 'json'; // JSON format const CONTENT_TYPE_JSON = 'json'; // JSON format
const CONTENT_TYPE_URLENCODED = 'urlencoded'; // urlencoded query string, like name1=value1&name2=value2 const CONTENT_TYPE_URLENCODED = 'urlencoded'; // urlencoded query string, like name1=value1&name2=value2
const CONTENT_TYPE_XML = 'xml'; // XML format const CONTENT_TYPE_XML = 'xml'; // XML format

5
extensions/yii/authclient/OpenId.php

@ -7,7 +7,6 @@
namespace yii\authclient; namespace yii\authclient;
use yii\base\Component;
use yii\base\Exception; use yii\base\Exception;
use yii\base\NotSupportedException; use yii\base\NotSupportedException;
@ -25,10 +24,8 @@ use yii\base\NotSupportedException;
* @author Paul Klimov <klimov.paul@gmail.com> * @author Paul Klimov <klimov.paul@gmail.com>
* @since 2.0 * @since 2.0
*/ */
class OpenId extends Component implements ClientInterface class OpenId extends BaseClient implements ClientInterface
{ {
use ClientTrait;
/** /**
* @var array list of attributes, which should be requested from server. * @var array list of attributes, which should be requested from server.
*/ */

9
tests/unit/extensions/authclient/ClientTraitTest.php → tests/unit/extensions/authclient/BaseClientTest.php

@ -2,11 +2,9 @@
namespace yiiunit\extensions\authclient; namespace yiiunit\extensions\authclient;
use yii\authclient\ClientInterface; use yii\authclient\BaseClient;
use yii\authclient\ClientTrait;
use yii\base\Object;
class ClientTraitTest extends TestCase class BaseClientTest extends TestCase
{ {
public function testSetGet() public function testSetGet()
{ {
@ -79,7 +77,6 @@ class ClientTraitTest extends TestCase
} }
} }
class Client extends Object implements ClientInterface class Client extends BaseClient
{ {
use ClientTrait;
} }

9
tests/unit/extensions/authclient/CollectionTest.php

@ -3,9 +3,7 @@
namespace yiiunit\extensions\authclient; namespace yiiunit\extensions\authclient;
use yii\authclient\Collection; use yii\authclient\Collection;
use yii\authclient\ClientInterface; use yii\authclient\BaseClient;
use yii\authclient\ClientTrait;
use yii\base\Object;
use yiiunit\extensions\authclient\TestCase; use yiiunit\extensions\authclient\TestCase;
class CollectionTest extends TestCase class CollectionTest extends TestCase
@ -82,9 +80,6 @@ class CollectionTest extends TestCase
} }
} }
class TestClient extends Object implements ClientInterface class TestClient extends BaseClient
{ {
use ClientTrait;
public function authenticate() {}
} }
Loading…
Cancel
Save