Commit e6f9aef3 by Qiang Xue

fixed test break.

parent cc636805
<?php <?php
namespace yiiunit; namespace yiiunit;
use yii\helpers\ArrayHelper;
/** /**
* This is the base class for all yii framework unit tests. * This is the base class for all yii framework unit tests.
...@@ -47,7 +48,7 @@ abstract class TestCase extends \PHPUnit_Framework_TestCase ...@@ -47,7 +48,7 @@ abstract class TestCase extends \PHPUnit_Framework_TestCase
]; ];
$defaultConfig['vendorPath'] = dirname(dirname(__DIR__)) . '/vendor'; $defaultConfig['vendorPath'] = dirname(dirname(__DIR__)) . '/vendor';
new $appClass(array_merge($defaultConfig, $config)); new $appClass(ArrayHelper::merge($defaultConfig, $config));
} }
/** /**
......
...@@ -11,7 +11,15 @@ class OAuth1Test extends TestCase ...@@ -11,7 +11,15 @@ class OAuth1Test extends TestCase
{ {
protected function setUp() protected function setUp()
{ {
$this->mockApplication([], '\yii\web\Application'); $config = [
'components' => [
'request' => [
'hostInfo' => 'http://testdomain.com',
'scriptUrl' => '/index.php',
],
]
];
$this->mockApplication($config, '\yii\web\Application');
} }
/** /**
...@@ -106,4 +114,4 @@ class OAuth1Test extends TestCase ...@@ -106,4 +114,4 @@ class OAuth1Test extends TestCase
$this->assertContains($authUrl, $builtAuthUrl, 'No auth URL present!'); $this->assertContains($authUrl, $builtAuthUrl, 'No auth URL present!');
$this->assertContains($requestTokenToken, $builtAuthUrl, 'No token present!'); $this->assertContains($requestTokenToken, $builtAuthUrl, 'No token present!');
} }
} }
\ No newline at end of file
...@@ -9,7 +9,15 @@ class OAuth2Test extends TestCase ...@@ -9,7 +9,15 @@ class OAuth2Test extends TestCase
{ {
protected function setUp() protected function setUp()
{ {
$this->mockApplication([], '\yii\web\Application'); $config = [
'components' => [
'request' => [
'hostInfo' => 'http://testdomain.com',
'scriptUrl' => '/index.php',
],
]
];
$this->mockApplication($config, '\yii\web\Application');
} }
// Tests : // Tests :
...@@ -30,4 +38,4 @@ class OAuth2Test extends TestCase ...@@ -30,4 +38,4 @@ class OAuth2Test extends TestCase
$this->assertContains($clientId, $builtAuthUrl, 'No client id present!'); $this->assertContains($clientId, $builtAuthUrl, 'No client id present!');
$this->assertContains(rawurlencode($returnUrl), $builtAuthUrl, 'No return URL present!'); $this->assertContains(rawurlencode($returnUrl), $builtAuthUrl, 'No return URL present!');
} }
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment