From e52273480b1c1bcfd7f1385fb72ab8b9721e73a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Burnichon?= Date: Wed, 9 Mar 2016 15:51:00 +0100 Subject: [PATCH] Rename Nosource tag into NoSource. Add fieldName property --- .../Tag/{Nosource.php => NoSource.php} | 26 +++++++++---------- lib/classes/databox/field.php | 12 ++++----- .../{NosourceTest.php => NoSourceTest.php} | 6 ++--- tests/classes/databox/fieldTest.php | 4 +-- 4 files changed, 24 insertions(+), 24 deletions(-) rename lib/Alchemy/Phrasea/Metadata/Tag/{Nosource.php => NoSource.php} (52%) rename tests/Alchemy/Tests/Phrasea/Metadata/Tag/{NosourceTest.php => NoSourceTest.php} (79%) diff --git a/lib/Alchemy/Phrasea/Metadata/Tag/Nosource.php b/lib/Alchemy/Phrasea/Metadata/Tag/NoSource.php similarity index 52% rename from lib/Alchemy/Phrasea/Metadata/Tag/Nosource.php rename to lib/Alchemy/Phrasea/Metadata/Tag/NoSource.php index 6b1b03ee00..047fda9fc8 100644 --- a/lib/Alchemy/Phrasea/Metadata/Tag/Nosource.php +++ b/lib/Alchemy/Phrasea/Metadata/Tag/NoSource.php @@ -1,9 +1,8 @@ Name = $name; + $this->fieldName = $fieldName; } - public function getTagname() + public function getFieldName() { - return $this->Name; + return $this->fieldName; } } diff --git a/lib/classes/databox/field.php b/lib/classes/databox/field.php index 5d7aa86438..d95b81c3c6 100644 --- a/lib/classes/databox/field.php +++ b/lib/classes/databox/field.php @@ -17,7 +17,7 @@ use Alchemy\Phrasea\Core\Event\Record\Structure\RecordStructureEvents; use Alchemy\Phrasea\Metadata\TagFactory; use Alchemy\Phrasea\Vocabulary; use Alchemy\Phrasea\Vocabulary\ControlProvider\ControlProviderInterface; -use Alchemy\Phrasea\Metadata\Tag\Nosource; +use Alchemy\Phrasea\Metadata\Tag\NoSource; use Doctrine\DBAL\Driver\Connection; use PHPExiftool\Exception\TagUnknown; use Alchemy\Phrasea\Exception\InvalidArgumentException; @@ -143,8 +143,8 @@ class databox_field implements cache_cacheableInterface } $this->name = $row['name']; - if ($this->tag instanceof Nosource) { - $this->tag = new Nosource($this->name); + if ($this->tag instanceof NoSource) { + $this->tag = new NoSource($this->name); } $this->indexable = (bool)$row['indexable']; $this->readonly = (bool)$row['readonly']; @@ -467,7 +467,7 @@ class databox_field implements cache_cacheableInterface $tagName = str_ireplace('/rdf:rdf/rdf:description/', '', $tagName); if ('' === trim($tagName)) { - return new Nosource(); + return new NoSource(); } try { @@ -478,7 +478,7 @@ class databox_field implements cache_cacheableInterface } } - return new Nosource($tagName); + return new NoSource($tagName); } /** @@ -488,7 +488,7 @@ class databox_field implements cache_cacheableInterface public function set_tag($tag = null) { if ($tag === null) { - $tag = new Nosource(); + $tag = new NoSource(); } $this->tag = $tag; diff --git a/tests/Alchemy/Tests/Phrasea/Metadata/Tag/NosourceTest.php b/tests/Alchemy/Tests/Phrasea/Metadata/Tag/NoSourceTest.php similarity index 79% rename from tests/Alchemy/Tests/Phrasea/Metadata/Tag/NosourceTest.php rename to tests/Alchemy/Tests/Phrasea/Metadata/Tag/NoSourceTest.php index f4547254e1..64c60e060c 100644 --- a/tests/Alchemy/Tests/Phrasea/Metadata/Tag/NosourceTest.php +++ b/tests/Alchemy/Tests/Phrasea/Metadata/Tag/NoSourceTest.php @@ -2,13 +2,13 @@ namespace Alchemy\Tests\Phrasea\Metadata\Tag; -use Alchemy\Phrasea\Metadata\Tag\Nosource; +use Alchemy\Phrasea\Metadata\Tag\NoSource; -class NosourceTest extends \PHPUnit_Framework_TestCase +class NoSourceTest extends \PHPUnit_Framework_TestCase { public function testObject() { - $object = new Nosource; + $object = new NoSource; $this->assertInstanceOf('\\PHPExiftool\\Driver\\TagInterface', $object); $this->assertInternalType('string', $object->getDescription()); diff --git a/tests/classes/databox/fieldTest.php b/tests/classes/databox/fieldTest.php index bb233ebfb3..35187d6d4d 100644 --- a/tests/classes/databox/fieldTest.php +++ b/tests/classes/databox/fieldTest.php @@ -148,8 +148,8 @@ class databox_fieldTest extends \PhraseanetTestCase $this->object_mono->set_tag(null); $this->object_multi->set_tag(null); - $this->assertEquals(new \Alchemy\Phrasea\Metadata\Tag\Nosource(), $this->object_mono->get_tag()); - $this->assertEquals(new \Alchemy\Phrasea\Metadata\Tag\Nosource(), $this->object_multi->get_tag()); + $this->assertEquals(new \Alchemy\Phrasea\Metadata\Tag\NoSource(), $this->object_mono->get_tag()); + $this->assertEquals(new \Alchemy\Phrasea\Metadata\Tag\NoSource(), $this->object_multi->get_tag()); } public function testGet_tag()