Skip to content
Permalink
Browse files

Test for empty translations

  • Loading branch information...
robertpustulka committed Jun 17, 2015
1 parent ec564bf commit 6cfbf2317fa92d851dffe5086724d126e720e851
Showing with 16 additions and 0 deletions.
  1. +16 −0 tests/TestCase/ORM/Behavior/Translate/TranslateTraitTest.php
@@ -63,6 +63,22 @@ public function testTranslationModify()
$this->assertEquals('Titulo', $entity->translation('spa')->get('title'));
}
/**
* Tests empty translations.
*
* @return void
*/
public function testTranslationEmpty()
{
$entity = new TestEntity;
$entity->set('_translations', [
'eng' => new Entity(['title' => 'My Title']),
'spa' => new Entity(['title' => 'Titulo'])
]);
$this->assertTrue($entity->translation('pol')->isNew());
$this->assertInstanceOf('Cake\Test\TestCase\ORM\Behavior\Translate\TestEntity', $entity->translation('pol'));
}
/**
* Tests that just accessing the translation will mark the property as dirty, this
* is to facilitate the saving process by not having to remember to mark the property

0 comments on commit 6cfbf23

Please sign in to comment.
You can’t perform that action at this time.