1<?php 2/* 3 * $Id: 1619TestCase.php 7490 2010-03-29 19:53:27Z jwage $ 4 * 5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 16 * 17 * This software consists of voluntary contributions made by many individuals 18 * and is licensed under the LGPL. For more information, see 19 * <http://www.doctrine-project.org>. 20 */ 21 22/** 23 * Doctrine_Ticket_1619_TestCase 24 * 25 * @package Doctrine 26 * @license http://www.opensource.org/licenses/lgpl-license.php LGPL 27 * @category Object Relational Mapping 28 * @link www.doctrine-project.org 29 * @since 1.0 30 * @version $Revision$ 31 */ 32class Doctrine_Ticket_1619_TestCase extends Doctrine_UnitTestCase { 33 34 public function prepareTables() 35 { 36 $this->tables[] = 'Ticket_1619_Article'; 37 parent::prepareTables(); 38 } 39 40 public function testTest() 41 { 42 $a = new Ticket_1619_Article(); 43 $a->Translation['fr']->name = 'article'; 44 $a->Translation['fr']->description = 'article'; 45 $a->Translation['en']->name = 'english article'; 46 $a->Translation['en']->description = 'english description'; 47 $a->save(); 48 49 $b = new Ticket_1619_Article(); 50 $a->Translation['fr']->name = 'maison'; 51 $a->Translation['fr']->description = 'habitation'; 52 $a->Translation['en']->name = 'english house'; 53 $a->Translation['en']->description = 'english big house'; 54 $a->save(); 55 } 56} 57 58class Ticket_1619_Article extends Doctrine_Record 59{ 60 public function setTableDefinition() 61 { 62 $this->setTableName('article'); 63 $this->hasColumn('id', 'integer', 3, array('type' => 'integer', 'primary' => true, 'autoincrement' => true, 'length' => '3')); 64 $this->hasColumn('name', 'string', 60, array('type' => 'string', 'length' => '60')); 65 $this->hasColumn('description', 'string', 4000, array('type' => 'string', 'length' => '4000')); 66 } 67 68 public function setUp() 69 { 70 $i18n0 = new Doctrine_Template_I18n(array('fields' => array(0 => 'name', 1 => 'description'))); 71 $searchable1 = new Doctrine_Template_Searchable(array('fields' => array(0 => 'name'))); 72 $i18n0->addChild($searchable1); 73 $this->actAs($i18n0); 74 } 75} 76 77 78