| | 437 | |
| | 438 | public function testI18nImportWithInteger() |
| | 439 | { |
| | 440 | $yml = <<<END |
| | 441 | --- |
| | 442 | I18nNumberLang: |
| | 443 | I18nNumberLang_1: |
| | 444 | name: test |
| | 445 | Translation: |
| | 446 | 0: |
| | 447 | title: english title |
| | 448 | body: english body |
| | 449 | 1: |
| | 450 | title: french title |
| | 451 | body: french body |
| | 452 | END; |
| | 453 | try { |
| | 454 | file_put_contents('test.yml', $yml); |
| | 455 | Doctrine::loadData('test.yml'); |
| | 456 | |
| | 457 | $this->conn->clear(); |
| | 458 | |
| | 459 | $query = new Doctrine_Query(); |
| | 460 | $query->from('I18nNumberLang i, i.Translation t'); |
| | 461 | |
| | 462 | $i = $query->execute()->getFirst(); |
| | 463 | |
| | 464 | $this->assertEqual($i->name, 'test'); |
| | 465 | $this->assertEqual($i->Translation['0']->title, 'english title'); |
| | 466 | $this->assertEqual($i->Translation['1']->title, 'french title'); |
| | 467 | $this->assertEqual($i->Translation['0']->body, 'english body'); |
| | 468 | $this->assertEqual($i->Translation['1']->body, 'french body'); |
| | 469 | |
| | 470 | $this->pass(); |
| | 471 | } catch (Exception $e) { |
| | 472 | $this->fail($e->getMessage()); |
| | 473 | } |
| | 474 | |
| | 475 | unlink('test.yml'); |
| | 476 | } |
| | 477 | |
| | 492 | |
| | 493 | class I18nNumberLang extends Doctrine_Record |
| | 494 | { |
| | 495 | public function setTableDefinition() |
| | 496 | { |
| | 497 | $this->hasColumn('name', 'string', 255); |
| | 498 | $this->hasColumn('title', 'string', 255); |
| | 499 | $this->hasColumn('body', 'clob'); |
| | 500 | } |
| | 501 | |
| | 502 | public function setUp() |
| | 503 | { |
| | 504 | $this->actAs('I18n', array('fields' => array('title', 'body'), 'type' => 'integer', 'length' => 4)); |
| | 505 | } |
| | 506 | } |