Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

T13007 nativearray missing patch #13748

Merged
merged 13 commits into from
Jan 10, 2019
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ branches:
only:
- master
- /^(4|5)\.\d+\.(\d+|x)$/
- /^T\d+-[a-zA-Z-]+/

addons:
apt:
Expand Down
2 changes: 1 addition & 1 deletion phalcon/translate/adapter/nativearray.zep
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class NativeArray extends Adapter implements \ArrayAccess
}

if fetch error, options["triggerError"] {
let this->triggerError = true;
let this->triggerError = (bool) error;
}

if typeof data !== "array" {
Expand Down
26 changes: 26 additions & 0 deletions tests/unit/Translate/Adapter/NativeArray/NotFoundCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,32 @@ function () {
);
}

/**
* Tests Phalcon\Translate\Adapter\NativeArray :: notFound() - triggerError random value
*
* @param UnitTester $I
*
* @author Phalcon Team <team@phalconphp.com>
* @since 2018-11-13
*/
public function translateAdapterNativearrayNotFoundTriggerErrorRandomVaue(UnitTester $I)
{
$I->wantToTest('Translate\Adapter\NativeArray - notFound() - triggerError random value');
$I->expectThrowable(
new \Exception('Cannot find translation key: unknown', 1024),
function () {
$language = $this->getArrayConfig()['en'];
$translator = new NativeArray(
[
'content' => $language,
'triggerError' => 'blahblah',
]
);
$translator->query('unknown');
}
);
}

/**
* Tests Phalcon\Translate\Adapter\NativeArray :: notFound() - custom
*
Expand Down