-
-
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.
Merge pull request #15968 from niden/T15902-nativearray
T15902 nativearray
- Loading branch information
Showing
5 changed files
with
121 additions
and
1 deletion.
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,49 @@ | ||
<?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\Tests\Unit\Translate\Adapter\Csv; | ||
|
||
use Phalcon\Tests\Fixtures\Traits\TranslateCsvTrait; | ||
use Phalcon\Translate\Adapter\Csv; | ||
use Phalcon\Translate\InterpolatorFactory; | ||
use UnitTester; | ||
|
||
class ToArrayCest | ||
{ | ||
use TranslateCsvTrait; | ||
|
||
/** | ||
* Tests Phalcon\Translate\Adapter\Csv :: toArray() | ||
* | ||
* @param UnitTester $I | ||
* | ||
* @author Phalcon Team <[email protected]> | ||
* @since 2020-09-09 | ||
*/ | ||
public function translateAdapterCsvToArray(UnitTester $I) | ||
{ | ||
$I->wantToTest('Translate\Adapter\Csv - toArray()'); | ||
|
||
$language = $this->getCsvConfig()['en']; | ||
$translator = new Csv(new InterpolatorFactory(), $language); | ||
|
||
$expected = [ | ||
'hi' => 'Hello', | ||
'bye' => 'Good Bye', | ||
'hello-key' => 'Hello %name%', | ||
'song-key' => 'This song is %song% (%artist%)', | ||
]; | ||
$actual = $translator->toArray(); | ||
$I->assertSame($expected, $actual); | ||
} | ||
} |
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,50 @@ | ||
<?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\Tests\Unit\Translate\Adapter\NativeArray; | ||
|
||
use Phalcon\Tests\Fixtures\Traits\TranslateNativeArrayTrait; | ||
use Phalcon\Translate\Adapter\NativeArray; | ||
use Phalcon\Translate\InterpolatorFactory; | ||
use UnitTester; | ||
|
||
class ToArrayCest | ||
{ | ||
use TranslateNativeArrayTrait; | ||
|
||
/** | ||
* Tests Phalcon\Translate\Adapter\NativeArray :: toArray() | ||
* | ||
* @param UnitTester $I | ||
* | ||
* @author Phalcon Team <[email protected]> | ||
* @since 2020-09-09 | ||
*/ | ||
public function translateAdapterNativeToArray(UnitTester $I) | ||
{ | ||
$I->wantToTest('Translate\Adapter\NativeArray - toArray()'); | ||
|
||
$language = $this->getArrayConfig()['en']; | ||
|
||
$translator = new NativeArray( | ||
new InterpolatorFactory(), | ||
[ | ||
'content' => $language, | ||
] | ||
); | ||
|
||
$expected = $language; | ||
$actual = $translator->toArray(); | ||
$I->assertSame($expected, $actual); | ||
} | ||
} |