fixed test break.

This commit is contained in:
Qiang Xue
2014-01-11 22:20:33 -05:00
parent cc636805da
commit e6f9aef3a9
3 changed files with 22 additions and 5 deletions

View File

@ -1,6 +1,7 @@
<?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
]; ];
$defaultConfig['vendorPath'] = dirname(dirname(__DIR__)) . '/vendor'; $defaultConfig['vendorPath'] = dirname(dirname(__DIR__)) . '/vendor';
new $appClass(array_merge($defaultConfig, $config)); new $appClass(ArrayHelper::merge($defaultConfig, $config));
} }
/** /**

View File

@ -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
$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!');
} }
} }

View File

@ -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
$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!');
} }
} }