From e9254ffee8c2822ed24f3dc07ebeaf8d2418029c Mon Sep 17 00:00:00 2001 From: Michael Roterman Date: Thu, 6 Feb 2014 00:04:12 +0100 Subject: [PATCH] Downsizing Translation --- lib/Tmdb/Model/Common/Translation.php | 41 +---------------- .../Tests/Model/Common/TranslationTest.php | 44 +++++++++++++++++++ 2 files changed, 45 insertions(+), 40 deletions(-) create mode 100644 test/Tmdb/Tests/Model/Common/TranslationTest.php diff --git a/lib/Tmdb/Model/Common/Translation.php b/lib/Tmdb/Model/Common/Translation.php index 975151f4..84a608e6 100644 --- a/lib/Tmdb/Model/Common/Translation.php +++ b/lib/Tmdb/Model/Common/Translation.php @@ -12,13 +12,10 @@ */ namespace Tmdb\Model\Common; -use Tmdb\Model\AbstractModel; use Tmdb\Model\Filter\LanguageFilter; -class Translation extends AbstractModel implements LanguageFilter { +class Translation extends SpokenLanguage implements LanguageFilter { - private $iso6391; - private $name; private $englishName; public static $_properties = array( @@ -44,40 +41,4 @@ public function getEnglishName() { return $this->englishName; } - - /** - * @param string $iso6391 - * @return $this - */ - public function setIso6391($iso6391) - { - $this->iso6391 = $iso6391; - return $this; - } - - /** - * @return string - */ - public function getIso6391() - { - return $this->iso6391; - } - - /** - * @param string $name - * @return $this - */ - public function setName($name) - { - $this->name = $name; - return $this; - } - - /** - * @return string - */ - public function getName() - { - return $this->name; - } } diff --git a/test/Tmdb/Tests/Model/Common/TranslationTest.php b/test/Tmdb/Tests/Model/Common/TranslationTest.php new file mode 100644 index 00000000..652fb868 --- /dev/null +++ b/test/Tmdb/Tests/Model/Common/TranslationTest.php @@ -0,0 +1,44 @@ + + * @copyright (c) 2013, Michael Roterman + * @version 0.0.1 + */ +namespace Tmdb\Tests\Model\Common; + +use Tmdb\Common\ObjectHydrator; +use Tmdb\Model\Common\Translation; +use Tmdb\Tests\Model\TestCase; + +class TranslationTest extends TestCase +{ + /** + * @test + * @todo fix + */ + public function shouldBeFunctional() + { + $data = array( + 'iso_639_1' => 'en', + 'name' => 'English', + 'english_name' => 'English' + ); + + $hydrator = new ObjectHydrator(); + + $object = $hydrator->hydrate(new Translation(), $data); + + /** + * @var Translation $object + */ + $this->assertEquals('en', $object->getIso6391()); + $this->assertEquals('English', $object->getName()); + $this->assertEquals('English', $object->getEnglishName()); + } +}