-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#3135] - Added getBestLanguageIso and reorganized a few tests
- Loading branch information
Showing
6 changed files
with
211 additions
and
125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
<?php | ||
|
||
/** | ||
* This file is part of the Phalcon Framework. | ||
* | ||
* (c) Phalcon Team <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE.txt | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Phalcon\Test\Unit\Http\Request; | ||
|
||
use Phalcon\Test\Fixtures\Traits\DiTrait; | ||
use UnitTester; | ||
|
||
class GetBestLanguageIsoCest | ||
{ | ||
use DiTrait; | ||
|
||
/** | ||
* Tests Phalcon\Http\Request :: getBestLanguageIso() | ||
* | ||
* @author Phalcon Team <[email protected]> | ||
* @since 2018-11-13 | ||
*/ | ||
public function httpRequestGetBestLanguageIso(UnitTester $I) | ||
{ | ||
$I->wantToTest('Http\Request - getBestLanguageIso()'); | ||
|
||
$store = $_SERVER ?? []; | ||
|
||
$this->setNewFactoryDefault(); | ||
$request = $this->container->get('request'); | ||
|
||
$_SERVER = [ | ||
'HTTP_ACCEPT_LANGUAGE' => 'es,es-ar;q=0.8' | ||
]; | ||
$I->assertEquals('es', $request->getBestLanguageIso()); | ||
|
||
$_SERVER = [ | ||
'HTTP_ACCEPT_LANGUAGE' => 'es-ar;q=0.8' | ||
]; | ||
$I->assertEquals('es', $request->getBestLanguageIso()); | ||
|
||
$_SERVER = [ | ||
'HTTP_ACCEPT_LANGUAGE' => 'en-US' | ||
]; | ||
$I->assertEquals('en', $request->getBestLanguageIso()); | ||
|
||
$_SERVER = [ | ||
'HTTP_ACCEPT_LANGUAGE' => 'en' | ||
]; | ||
$I->assertEquals('en', $request->getBestLanguageIso()); | ||
|
||
$_SERVER = [ | ||
'HTTP_ACCEPT_LANGUAGE' => '' | ||
]; | ||
$I->assertEquals('', $request->getBestLanguageIso()); | ||
|
||
$_SERVER = $store; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.