Skip to content

Commit

Permalink
Apply fixes from StyleCI (#835)
Browse files Browse the repository at this point in the history
[ci skip] [skip ci]
  • Loading branch information
overtrue authored Aug 2, 2017
1 parent 20380ab commit d00f714
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 20 deletions.
12 changes: 9 additions & 3 deletions tests/Kernel/Http/ResponseTest.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
<?php

/*
* This file is part of the overtrue/wechat.
*
* (c) overtrue <i@overtrue.me>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/

namespace EasyWeChat\Tests\Kernel\Http;


use EasyWeChat\Kernel\Http\Response;
use EasyWeChat\Kernel\Support\Collection;
use EasyWeChat\Tests\TestCase;


class ResponseTest extends TestCase
{
public function testBasicFeatures()
Expand All @@ -17,7 +23,7 @@ public function testBasicFeatures()

$this->assertInstanceOf(\GuzzleHttp\Psr7\Response::class, $response);

$this->assertSame('{"name": "easywechat"}', (string)$response);
$this->assertSame('{"name": "easywechat"}', (string) $response);
$this->assertSame('{"name": "easywechat"}', $response->getBodyContents());
$this->assertSame('{"name":"easywechat"}', $response->toJson());
$this->assertSame(['name' => 'easywechat'], $response->toArray());
Expand Down
16 changes: 11 additions & 5 deletions tests/Kernel/Traits/HasAttributesTest.php
Original file line number Diff line number Diff line change
@@ -1,21 +1,27 @@
<?php

/*
* This file is part of the overtrue/wechat.
*
* (c) overtrue <i@overtrue.me>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/

namespace EasyWeChat\Tests\Kernel\Traits;


use EasyWeChat\Kernel\Traits\HasAttributes;
use EasyWeChat\Tests\TestCase;


class HasAttributesTest extends TestCase
{
public function testBasicFeatures()
{
$cls = new DummyClassForHasAttributesTest();

$cls->setAttributes([
'foo' => 'bar'
'foo' => 'bar',
]);

// required
Expand Down Expand Up @@ -55,7 +61,7 @@ public function testWith()
$cls = new DummyClassForHasAttributesTest();

$cls->setAttributes([
'foo' => 'bar'
'foo' => 'bar',
]);

$cls->with('bar', 'mock-value');
Expand All @@ -75,4 +81,4 @@ class DummyClassForHasAttributesTest
use HasAttributes;

protected $required = ['foo'];
}
}
29 changes: 19 additions & 10 deletions tests/Kernel/Traits/HasHttpRequestsTest.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
<?php

/*
* This file is part of the overtrue/wechat.
*
* (c) overtrue <i@overtrue.me>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/

namespace EasyWeChat\Tests\Kernel\Traits;


use EasyWeChat\Kernel\Http\Response;
use EasyWeChat\Kernel\Support\Collection;
use EasyWeChat\Kernel\Traits\HasHttpRequests;
Expand All @@ -12,7 +19,6 @@
use GuzzleHttp\ClientInterface;
use GuzzleHttp\HandlerStack;


class HasHttpRequestsTest extends TestCase
{
public function testDefaultOptions()
Expand Down Expand Up @@ -43,9 +49,12 @@ public function testMiddlewareFeatures()
$cls = \Mockery::mock(HasHttpRequests::class);
$this->assertEmpty($cls->getMiddlewares());

$fn1 = function() {};
$fn2 = function() {};
$fn3 = function() {};
$fn1 = function () {
};
$fn2 = function () {
};
$fn3 = function () {
};

$cls->pushMiddleware($fn1, 'fn1');
$cls->pushMiddleware($fn2, 'fn2');
Expand Down Expand Up @@ -92,12 +101,13 @@ public function testRequest()
public function testHandlerStack()
{
$cls = \Mockery::mock(HasHttpRequests::class);
$fn1 = function() {};
$fn1 = function () {
};
$cls->pushMiddleware($fn1, 'fn1');

$handlerStack = $cls->getHandlerStack();
$this->assertInstanceOf(HandlerStack::class, $handlerStack);
$this->assertContains('Name: \'fn1\', Function: callable', (string)$handlerStack);
$this->assertContains('Name: \'fn1\', Function: callable', (string) $handlerStack);

$handlerStack2 = \Mockery::mock(HandlerStack::class);
$cls->setHandlerStack($handlerStack2);
Expand Down Expand Up @@ -166,10 +176,9 @@ public function __construct($response)
}
}


class DummnyClassForHasHttpRequestTest
{
use HasHttpRequests;

protected $baseUri = 'http://easywechat.com';
}
}
10 changes: 8 additions & 2 deletions tests/Kernel/Traits/InteractsWithCacheTest.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
<?php

/*
* This file is part of the overtrue/wechat.
*
* (c) overtrue <i@overtrue.me>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/

namespace EasyWeChat\Tests\Kernel\Traits;


use EasyWeChat\Kernel\Traits\InteractsWithCache;
use EasyWeChat\Tests\TestCase;
use Psr\SimpleCache\CacheInterface;


class InteractsWithCacheTest extends TestCase
{
public function testBasicFeatures()
Expand Down

0 comments on commit d00f714

Please sign in to comment.