Skip to content
This repository
tree: 66d374071d
Fetching contributors…

Cannot retrieve contributors at this time

file 65 lines (60 sloc) 2.231 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
<?php

/*
* $Id: VersionableBehaviorTest.php 1460 2010-01-17 22:36:48Z francois $
* This file is part of the Propel package.
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @license MIT License
*/

require_once dirname(__FILE__) . '/../../../../../generator/lib/util/PropelQuickBuilder.php';
require_once dirname(__FILE__) . '/../../../../../generator/lib/behavior/i18n/I18nBehavior.php';
require_once dirname(__FILE__) . '/../../../../../runtime/lib/Propel.php';

/**
* Tests for I18nBehavior class peer modifier
*
* @author François Zaninotto
* @version $Revision$
* @package generator.behavior.i18n
*/
class I18nBehaviorPeerBuilderModifierTest extends PHPUnit_Framework_TestCase
{
    public function testDefaultLocaleConstant()
    {
        $schema = <<<EOF
<database name="i18n_behavior_test_0">
    <table name="i18n_behavior_test_01">
        <column name="id" primaryKey="true" type="INTEGER" autoIncrement="true" />
        <behavior name="i18n" />
    </table>
    <table name="i18n_behavior_test_02">
        <column name="id" primaryKey="true" type="INTEGER" autoIncrement="true" />
        <behavior name="i18n">
            <parameter name="default_locale" value="fr_FR" />
        </behavior>
    </table>
</database>
EOF;
        PropelQuickBuilder::buildSchema($schema);
        $this->assertEquals('en_US', I18nBehaviorTest01Peer::DEFAULT_LOCALE);
        $this->assertEquals('fr_FR', I18nBehaviorTest02Peer::DEFAULT_LOCALE);
    }

    public function testFieldKeys()
    {
        $schema = <<<EOF
<database name="i18n_behavior_test_0">
    <table name="i18n_behavior_test_03">
        <column name="id" primaryKey="true" type="INTEGER" autoIncrement="true" />
        <column name="foo1" type="VARCHAR" />
        <column name="foo2" type="VARCHAR" />
        <column name="foo3" type="VARCHAR" />
        <behavior name="i18n">
            <parameter name="i18n_columns" value="foo2" />
        </behavior>
    </table>
</database>
EOF;
        PropelQuickBuilder::buildSchema($schema);
        $this->assertEquals(array(0, 1, 2), I18nBehaviorTest03Peer::getFieldNames(BasePeer::TYPE_NUM));
    }

}
Something went wrong with that request. Please try again.