3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.7 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2016 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
10 | CiviCRM is free software; you can copy, modify, and distribute it |
11 | under the terms of the GNU Affero General Public License |
12 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
14 | CiviCRM is distributed in the hope that it will be useful, but |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | See the GNU Affero General Public License for more details. |
19 | You should have received a copy of the GNU Affero General Public |
20 | License and the CiviCRM Licensing Exception along |
21 | with this program; if not, contact CiviCRM LLC |
22 | at info[AT]civicrm[DOT]org. If you have questions about the |
23 | GNU Affero General Public License or the licensing of CiviCRM, |
24 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
25 +--------------------------------------------------------------------+
29 * Test class for the option.language API parameter in multilingual.
34 class api_v3_MultilingualTest
extends CiviUnitTestCase
{
35 protected $_apiversion = 3;
36 public $DBResetRequired = FALSE;
39 * Sets up the fixture, for example, opens a network connection.
41 * This method is called before a test is executed.
43 protected function setUp() {
45 $this->useTransaction(TRUE);
48 public function tearDown() {
49 CRM_Core_I18n_Schema
::makeSinglelingual('en_US');
53 public function testOptionLanguage() {
54 $this->callAPISuccess('Setting', 'create', array(
55 'lcMessages' => 'en_US',
56 'languageLimit' => array(
61 CRM_Core_I18n_Schema
::makeMultilingual('en_US');
66 CRM_Core_I18n_Schema
::addLocale('fr_CA', 'en_US');
68 $this->callAPISuccess('Setting', 'create', array(
69 'languageLimit' => array(
75 // Take a semi-random OptionGroup and test manually changing its label
76 // in one language, while making sure it stays the same in English.
77 $group = $this->callAPISuccess('OptionGroup', 'getsingle', array(
78 'name' => 'contact_edit_options',
81 $english_original = $this->callAPISuccess('OptionValue', 'getsingle', array(
82 'option_group_id' => $group['id'],
86 $this->callAPISuccess('OptionValue', 'create', array(
87 'id' => $english_original['id'],
89 'label' => 'Messagerie instantanée',
90 'option.language' => 'fr_CA',
93 $french = $this->callAPISuccess('OptionValue', 'getsingle', array(
94 'option_group_id' => $group['id'],
96 'option.language' => 'fr_CA',
99 $default = $this->callAPISuccess('OptionValue', 'getsingle', array(
100 'option_group_id' => $group['id'],
102 'option.language' => 'en_US',
105 $this->assertEquals($french['label'], 'Messagerie instantanée');
106 $this->assertEquals($default['label'], $english_original['label']);