diff --git a/README.md b/README.md index 05b2647..b9e8da5 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ This package allows you to easily build a tagcloud from PHP. ## Requirements -This package requires PHP 7 and the renderers make use of [vdhicts/htmlelement](https://github.com/vdhicts/html-element). +This package requires PHP 7 and the renderers make use of [vdhicts/dicms-html-element](https://github.com/vdhicts/dicms-html-element). ## Installation diff --git a/composer.json b/composer.json index 91feabb..9f11a8c 100644 --- a/composer.json +++ b/composer.json @@ -10,14 +10,14 @@ ], "require": { "php": "^7.0", - "vdhicts/html-element": "^1.2" + "vdhicts/html-element": "^2.0" }, "require-dev": { "phpunit/phpunit": "^6.4" }, "autoload": { "psr-4": { - "Vdhicts\\TagcloudBuilder\\": "src/" + "Vdhicts\\Dicms\\Tagcloud\\": "src/" } } } diff --git a/composer.lock b/composer.lock index d29634d..c780d07 100644 --- a/composer.lock +++ b/composer.lock @@ -4,20 +4,20 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "4f118027ebb24b19268a2fa496192c40", + "content-hash": "5b391e2a31dd0db72e3f773bcf14a8b4", "packages": [ { "name": "vdhicts/html-element", - "version": "1.2.0", + "version": "2.0.0", "source": { "type": "git", - "url": "https://github.com/vdhicts/html-element.git", - "reference": "8dc24d47f30498d43bd2fcf9bda8d3092311e642" + "url": "https://github.com/vdhicts/dicms-html-element.git", + "reference": "4b1013c78cd8d1bc677508ec732a1ba5305e7e4e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vdhicts/html-element/zipball/8dc24d47f30498d43bd2fcf9bda8d3092311e642", - "reference": "8dc24d47f30498d43bd2fcf9bda8d3092311e642", + "url": "https://api.github.com/repos/vdhicts/dicms-html-element/zipball/4b1013c78cd8d1bc677508ec732a1ba5305e7e4e", + "reference": "4b1013c78cd8d1bc677508ec732a1ba5305e7e4e", "shasum": "" }, "require": { @@ -29,7 +29,7 @@ "type": "library", "autoload": { "psr-4": { - "Vdhicts\\HtmlElement\\": "src/" + "Vdhicts\\Dicms\\Html\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -39,11 +39,13 @@ "authors": [ { "name": "Dick van der Heiden", - "email": "info@vdhicts.nl" + "email": "info@vdhicts.nl", + "homepage": "https://www.vdhicts.nl", + "role": "Developer" } ], "description": "Easily create HTML elements from PHP", - "time": "2017-08-30T09:09:30+00:00" + "time": "2018-05-03T19:17:47+00:00" } ], "packages-dev": [ @@ -103,37 +105,40 @@ }, { "name": "myclabs/deep-copy", - "version": "1.6.1", + "version": "1.7.0", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "8e6e04167378abf1ddb4d3522d8755c5fd90d102" + "reference": "3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/8e6e04167378abf1ddb4d3522d8755c5fd90d102", - "reference": "8e6e04167378abf1ddb4d3522d8755c5fd90d102", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e", + "reference": "3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e", "shasum": "" }, "require": { - "php": ">=5.4.0" + "php": "^5.6 || ^7.0" }, "require-dev": { - "doctrine/collections": "1.*", - "phpunit/phpunit": "~4.1" + "doctrine/collections": "^1.0", + "doctrine/common": "^2.6", + "phpunit/phpunit": "^4.1" }, "type": "library", "autoload": { "psr-4": { "DeepCopy\\": "src/DeepCopy/" - } + }, + "files": [ + "src/DeepCopy/deep_copy.php" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "description": "Create deep copies (clones) of your objects", - "homepage": "https://github.com/myclabs/DeepCopy", "keywords": [ "clone", "copy", @@ -141,7 +146,7 @@ "object", "object graph" ], - "time": "2017-04-12T18:52:22+00:00" + "time": "2017-10-19T19:58:43+00:00" }, { "name": "phar-io/manifest", @@ -301,29 +306,35 @@ }, { "name": "phpdocumentor/reflection-docblock", - "version": "4.1.1", + "version": "4.3.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "2d3d238c433cf69caeb4842e97a3223a116f94b2" + "reference": "94fd0001232e47129dd3504189fa1c7225010d08" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/2d3d238c433cf69caeb4842e97a3223a116f94b2", - "reference": "2d3d238c433cf69caeb4842e97a3223a116f94b2", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/94fd0001232e47129dd3504189fa1c7225010d08", + "reference": "94fd0001232e47129dd3504189fa1c7225010d08", "shasum": "" }, "require": { "php": "^7.0", - "phpdocumentor/reflection-common": "^1.0@dev", + "phpdocumentor/reflection-common": "^1.0.0", "phpdocumentor/type-resolver": "^0.4.0", "webmozart/assert": "^1.0" }, "require-dev": { - "mockery/mockery": "^0.9.4", - "phpunit/phpunit": "^4.4" + "doctrine/instantiator": "~1.0.5", + "mockery/mockery": "^1.0", + "phpunit/phpunit": "^6.4" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.x-dev" + } + }, "autoload": { "psr-4": { "phpDocumentor\\Reflection\\": [ @@ -342,7 +353,7 @@ } ], "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "time": "2017-08-30T18:51:59+00:00" + "time": "2017-11-30T07:14:17+00:00" }, { "name": "phpdocumentor/type-resolver", @@ -393,28 +404,28 @@ }, { "name": "phpspec/prophecy", - "version": "v1.7.2", + "version": "1.7.6", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "c9b8c6088acd19d769d4cc0ffa60a9fe34344bd6" + "reference": "33a7e3c4fda54e912ff6338c48823bd5c0f0b712" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/c9b8c6088acd19d769d4cc0ffa60a9fe34344bd6", - "reference": "c9b8c6088acd19d769d4cc0ffa60a9fe34344bd6", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/33a7e3c4fda54e912ff6338c48823bd5c0f0b712", + "reference": "33a7e3c4fda54e912ff6338c48823bd5c0f0b712", "shasum": "" }, "require": { "doctrine/instantiator": "^1.0.2", "php": "^5.3|^7.0", "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0", - "sebastian/comparator": "^1.1|^2.0", + "sebastian/comparator": "^1.1|^2.0|^3.0", "sebastian/recursion-context": "^1.0|^2.0|^3.0" }, "require-dev": { "phpspec/phpspec": "^2.5|^3.2", - "phpunit/phpunit": "^4.8 || ^5.6.5" + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5" }, "type": "library", "extra": { @@ -452,20 +463,20 @@ "spy", "stub" ], - "time": "2017-09-04T11:05:03+00:00" + "time": "2018-04-18T13:57:24+00:00" }, { "name": "phpunit/php-code-coverage", - "version": "5.2.2", + "version": "5.3.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "8ed1902a57849e117b5651fc1a5c48110946c06b" + "reference": "c89677919c5dd6d3b3852f230a663118762218ac" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/8ed1902a57849e117b5651fc1a5c48110946c06b", - "reference": "8ed1902a57849e117b5651fc1a5c48110946c06b", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/c89677919c5dd6d3b3852f230a663118762218ac", + "reference": "c89677919c5dd6d3b3852f230a663118762218ac", "shasum": "" }, "require": { @@ -474,14 +485,13 @@ "php": "^7.0", "phpunit/php-file-iterator": "^1.4.2", "phpunit/php-text-template": "^1.2.1", - "phpunit/php-token-stream": "^1.4.11 || ^2.0", + "phpunit/php-token-stream": "^2.0.1", "sebastian/code-unit-reverse-lookup": "^1.0.1", "sebastian/environment": "^3.0", "sebastian/version": "^2.0.1", "theseer/tokenizer": "^1.1" }, "require-dev": { - "ext-xdebug": "^2.5", "phpunit/phpunit": "^6.0" }, "suggest": { @@ -490,7 +500,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "5.2.x-dev" + "dev-master": "5.3.x-dev" } }, "autoload": { @@ -505,7 +515,7 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", + "email": "sebastian@phpunit.de", "role": "lead" } ], @@ -516,20 +526,20 @@ "testing", "xunit" ], - "time": "2017-08-03T12:40:43+00:00" + "time": "2018-04-06T15:36:58+00:00" }, { "name": "phpunit/php-file-iterator", - "version": "1.4.2", + "version": "1.4.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "3cc8f69b3028d0f96a9078e6295d86e9bf019be5" + "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/3cc8f69b3028d0f96a9078e6295d86e9bf019be5", - "reference": "3cc8f69b3028d0f96a9078e6295d86e9bf019be5", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/730b01bc3e867237eaac355e06a36b85dd93a8b4", + "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4", "shasum": "" }, "require": { @@ -563,7 +573,7 @@ "filesystem", "iterator" ], - "time": "2016-10-03T07:40:28+00:00" + "time": "2017-11-27T13:52:08+00:00" }, { "name": "phpunit/php-text-template", @@ -657,16 +667,16 @@ }, { "name": "phpunit/php-token-stream", - "version": "2.0.1", + "version": "2.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "9a02332089ac48e704c70f6cefed30c224e3c0b0" + "reference": "791198a2c6254db10131eecfe8c06670700904db" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/9a02332089ac48e704c70f6cefed30c224e3c0b0", - "reference": "9a02332089ac48e704c70f6cefed30c224e3c0b0", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/791198a2c6254db10131eecfe8c06670700904db", + "reference": "791198a2c6254db10131eecfe8c06670700904db", "shasum": "" }, "require": { @@ -702,20 +712,20 @@ "keywords": [ "tokenizer" ], - "time": "2017-08-20T05:47:52+00:00" + "time": "2017-11-27T05:48:46+00:00" }, { "name": "phpunit/phpunit", - "version": "6.4.3", + "version": "6.5.8", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "06b28548fd2b4a20c3cd6e247dc86331a7d4db13" + "reference": "4f21a3c6b97c42952fd5c2837bb354ec0199b97b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/06b28548fd2b4a20c3cd6e247dc86331a7d4db13", - "reference": "06b28548fd2b4a20c3cd6e247dc86331a7d4db13", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/4f21a3c6b97c42952fd5c2837bb354ec0199b97b", + "reference": "4f21a3c6b97c42952fd5c2837bb354ec0199b97b", "shasum": "" }, "require": { @@ -729,12 +739,12 @@ "phar-io/version": "^1.0", "php": "^7.0", "phpspec/prophecy": "^1.7", - "phpunit/php-code-coverage": "^5.2.2", - "phpunit/php-file-iterator": "^1.4.2", + "phpunit/php-code-coverage": "^5.3", + "phpunit/php-file-iterator": "^1.4.3", "phpunit/php-text-template": "^1.2.1", "phpunit/php-timer": "^1.0.9", - "phpunit/phpunit-mock-objects": "^4.0.3", - "sebastian/comparator": "^2.0.2", + "phpunit/phpunit-mock-objects": "^5.0.5", + "sebastian/comparator": "^2.1", "sebastian/diff": "^2.0", "sebastian/environment": "^3.1", "sebastian/exporter": "^3.1", @@ -760,7 +770,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "6.4.x-dev" + "dev-master": "6.5.x-dev" } }, "autoload": { @@ -786,33 +796,33 @@ "testing", "xunit" ], - "time": "2017-10-16T13:18:59+00:00" + "time": "2018-04-10T11:38:34+00:00" }, { "name": "phpunit/phpunit-mock-objects", - "version": "4.0.4", + "version": "5.0.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", - "reference": "2f789b59ab89669015ad984afa350c4ec577ade0" + "reference": "33fd41a76e746b8fa96d00b49a23dadfa8334cdf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/2f789b59ab89669015ad984afa350c4ec577ade0", - "reference": "2f789b59ab89669015ad984afa350c4ec577ade0", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/33fd41a76e746b8fa96d00b49a23dadfa8334cdf", + "reference": "33fd41a76e746b8fa96d00b49a23dadfa8334cdf", "shasum": "" }, "require": { "doctrine/instantiator": "^1.0.5", "php": "^7.0", "phpunit/php-text-template": "^1.2.1", - "sebastian/exporter": "^3.0" + "sebastian/exporter": "^3.1" }, "conflict": { "phpunit/phpunit": "<6.0" }, "require-dev": { - "phpunit/phpunit": "^6.0" + "phpunit/phpunit": "^6.5" }, "suggest": { "ext-soap": "*" @@ -820,7 +830,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0.x-dev" + "dev-master": "5.0.x-dev" } }, "autoload": { @@ -835,7 +845,7 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", + "email": "sebastian@phpunit.de", "role": "lead" } ], @@ -845,7 +855,7 @@ "mock", "xunit" ], - "time": "2017-08-03T14:08:16+00:00" + "time": "2018-01-06T05:45:45+00:00" }, { "name": "sebastian/code-unit-reverse-lookup", @@ -894,30 +904,30 @@ }, { "name": "sebastian/comparator", - "version": "2.0.2", + "version": "2.1.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "ae068fede81d06e7bb9bb46a367210a3d3e1fe6a" + "reference": "34369daee48eafb2651bea869b4b15d75ccc35f9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/ae068fede81d06e7bb9bb46a367210a3d3e1fe6a", - "reference": "ae068fede81d06e7bb9bb46a367210a3d3e1fe6a", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/34369daee48eafb2651bea869b4b15d75ccc35f9", + "reference": "34369daee48eafb2651bea869b4b15d75ccc35f9", "shasum": "" }, "require": { "php": "^7.0", - "sebastian/diff": "^2.0", - "sebastian/exporter": "^3.0" + "sebastian/diff": "^2.0 || ^3.0", + "sebastian/exporter": "^3.1" }, "require-dev": { - "phpunit/phpunit": "^6.0" + "phpunit/phpunit": "^6.4" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "2.1.x-dev" } }, "autoload": { @@ -948,13 +958,13 @@ } ], "description": "Provides the functionality to compare PHP values for equality", - "homepage": "http://www.github.com/sebastianbergmann/comparator", + "homepage": "https://github.com/sebastianbergmann/comparator", "keywords": [ "comparator", "compare", "equality" ], - "time": "2017-08-03T07:14:59+00:00" + "time": "2018-02-01T13:46:46+00:00" }, { "name": "sebastian/diff", @@ -1448,16 +1458,16 @@ }, { "name": "webmozart/assert", - "version": "1.2.0", + "version": "1.3.0", "source": { "type": "git", "url": "https://github.com/webmozart/assert.git", - "reference": "2db61e59ff05fe5126d152bd0655c9ea113e550f" + "reference": "0df1908962e7a3071564e857d86874dad1ef204a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webmozart/assert/zipball/2db61e59ff05fe5126d152bd0655c9ea113e550f", - "reference": "2db61e59ff05fe5126d152bd0655c9ea113e550f", + "url": "https://api.github.com/repos/webmozart/assert/zipball/0df1908962e7a3071564e857d86874dad1ef204a", + "reference": "0df1908962e7a3071564e857d86874dad1ef204a", "shasum": "" }, "require": { @@ -1494,7 +1504,7 @@ "check", "validate" ], - "time": "2016-11-23T20:04:58+00:00" + "time": "2018-01-29T19:49:41+00:00" } ], "aliases": [], diff --git a/src/Builder.php b/src/Builder.php index 5a946f3..5593585 100644 --- a/src/Builder.php +++ b/src/Builder.php @@ -1,6 +1,6 @@ setAttribute('class', 'tag'); $tagcloudItemHtml->addAttributeValue('class', $this->getTagcloudItemClass($tag)); if (! $tag->hasLink()) { @@ -57,7 +57,7 @@ private function generateTagcloudItem(Tag $tag): HtmlElement return $tagcloudItemHtml; } - $linkHtml = new HtmlElement('a', $tag->getName(), ['href' => $tag->getLink()]); + $linkHtml = new Html\Element('a', $tag->getName(), ['href' => $tag->getLink()]); $tagcloudItemHtml->inject($linkHtml); return $tagcloudItemHtml; @@ -76,7 +76,7 @@ public function generate(TagCollection $tagCollection): string $this->totalTagOccurrence = $this->calculateTotalTagOccurrence($tagCollection); - $tagcloudHtml = new HtmlElement('ul'); + $tagcloudHtml = new Html\Element('ul'); $tagcloudHtml->setAttribute('class', 'tagcloud'); foreach ($tagCollection->getTags() as $tag) { $tagcloudHtml->inject($this->generateTagcloudItem($tag)); diff --git a/src/Tag.php b/src/Tag.php index 43a0643..86552d2 100644 --- a/src/Tag.php +++ b/src/Tag.php @@ -1,8 +1,8 @@ addTag($phpTag) ->addTag($javascriptTag) ->addTag($mysqlTag); @@ -21,17 +21,17 @@ private function getBaseTagCollection() public function testDefaultRenderWithEmptyCollection() { - $emptyBuilder = new TagcloudBuilder\Builder(new TagcloudBuilder\TagCollection(), new TagcloudBuilder\Renderers\DefaultRenderer()); + $emptyBuilder = new Tagcloud\Builder(new Tagcloud\TagCollection(), new Tagcloud\Renderers\DefaultRenderer()); $this->assertSame('', $emptyBuilder->generate()); } public function testDefaultRenderer() { - $builder = new TagcloudBuilder\Builder($this->getBaseTagCollection(), new TagcloudBuilder\Renderers\DefaultRenderer()); + $builder = new Tagcloud\Builder($this->getBaseTagCollection(), new Tagcloud\Renderers\DefaultRenderer()); - $this->assertInstanceOf(TagcloudBuilder\Builder::class, $builder); - $this->assertInstanceOf(TagcloudBuilder\TagCollection::class, $builder->getTagCollection()); - $this->assertInstanceOf(TagcloudBuilder\Renderers\DefaultRenderer::class, $builder->getRenderer()); + $this->assertInstanceOf(Tagcloud\Builder::class, $builder); + $this->assertInstanceOf(Tagcloud\TagCollection::class, $builder->getTagCollection()); + $this->assertInstanceOf(Tagcloud\Renderers\DefaultRenderer::class, $builder->getRenderer()); $expectedHtml = ''; $generatedHtml = $builder->generate(); diff --git a/tests/unit/ParserTest.php b/tests/unit/ParserTest.php index d4ad142..9cd94d1 100644 --- a/tests/unit/ParserTest.php +++ b/tests/unit/ParserTest.php @@ -1,7 +1,7 @@ parse(); - $this->assertInstanceOf(TagcloudBuilder\TagCollection::class, $tagCollection); + $this->assertInstanceOf(Tagcloud\TagCollection::class, $tagCollection); $this->assertSame(3, $tagCollection->count()); $tags = $tagCollection->getTags(); - $this->assertInstanceOf(TagcloudBuilder\Tag::class, $tags[0]); - $this->assertInstanceOf(TagcloudBuilder\Tag::class, $tags[1]); - $this->assertInstanceOf(TagcloudBuilder\Tag::class, $tags[2]); + $this->assertInstanceOf(Tagcloud\Tag::class, $tags[0]); + $this->assertInstanceOf(Tagcloud\Tag::class, $tags[1]); + $this->assertInstanceOf(Tagcloud\Tag::class, $tags[2]); $this->assertTrue(in_array($tags[0]->getName(), $tagNames)); $this->assertTrue(in_array($tags[1]->getName(), $tagNames)); $this->assertTrue(in_array($tags[2]->getName(), $tagNames)); @@ -29,8 +29,8 @@ public function testParser() public function testParserWithInvalidSeparator() { - $this->expectException(TagcloudBuilder\Exceptions\InvalidParserSeparatorException::class); + $this->expectException(Tagcloud\Exceptions\InvalidParserSeparatorException::class); - $parser = new TagcloudBuilder\Parser('php, javascript, mysql', ''); + $parser = new Tagcloud\Parser('php, javascript, mysql', ''); } } diff --git a/tests/unit/TagCollectionTest.php b/tests/unit/TagCollectionTest.php index 1a037a5..dccfe5b 100644 --- a/tests/unit/TagCollectionTest.php +++ b/tests/unit/TagCollectionTest.php @@ -1,18 +1,17 @@ addTag($phpTag) ->addTag($javascriptTag) ->addTag($mysqlTag); @@ -24,7 +23,7 @@ public function testTagCollectionBuild() { $tagCollection = $this->getBaseTagCollection(); - $this->assertInstanceOf(TagcloudBuilder\TagCollection::class, $tagCollection); + $this->assertInstanceOf(Tagcloud\TagCollection::class, $tagCollection); } public function testTagCollectionCheck() @@ -32,7 +31,7 @@ public function testTagCollectionCheck() $tagCollection = $this->getBaseTagCollection(); $this->assertTrue($tagCollection->hasTags()); - $emptyTagCollection = new TagcloudBuilder\TagCollection(); + $emptyTagCollection = new Tagcloud\TagCollection(); $this->assertFalse($emptyTagCollection->hasTags()); } @@ -43,18 +42,18 @@ public function testTagCollectionRetrieval() $this->assertSame(3, $tagCollection->count()); $this->assertSame(3, count($tagCollection->getTags())); - $this->assertInstanceOf(Tag::class, $tagCollection->getTag('PHP')); + $this->assertInstanceOf(Tagcloud\Tag::class, $tagCollection->getTag('PHP')); $this->assertSame('PHP', $tagCollection->getTag('PHP')->getName()); $this->assertNull($tagCollection->getTag('something')); } public function testTagCollectionStoring() { - $phpTag = new TagcloudBuilder\Tag('PHP'); - $javascriptTag = new TagcloudBuilder\Tag('JavaScript', 'http://www.example.com/javascript', 2); - $mysqlTag = new TagcloudBuilder\Tag('MySQL', 'http://www.example.com/mysql', 5); + $phpTag = new Tagcloud\Tag('PHP'); + $javascriptTag = new Tagcloud\Tag('JavaScript', 'http://www.example.com/javascript', 2); + $mysqlTag = new Tagcloud\Tag('MySQL', 'http://www.example.com/mysql', 5); - $tagCollection = new TagcloudBuilder\TagCollection(); + $tagCollection = new Tagcloud\TagCollection(); $tagCollection->setTags([$phpTag, $javascriptTag, $mysqlTag]); $this->assertSame(3, $tagCollection->count()); @@ -62,11 +61,11 @@ public function testTagCollectionStoring() public function testTagCollectionExpansion() { - $phpTag = new TagcloudBuilder\Tag('PHP'); - $javascriptTag = new TagcloudBuilder\Tag('JavaScript'); - $mysqlTag = new TagcloudBuilder\Tag('MySQL'); + $phpTag = new Tagcloud\Tag('PHP'); + $javascriptTag = new Tagcloud\Tag('JavaScript'); + $mysqlTag = new Tagcloud\Tag('MySQL'); - $tagCollection = new TagcloudBuilder\TagCollection(); + $tagCollection = new Tagcloud\TagCollection(); $tagCollection->addTag($phpTag); $tagCollection->addTag($javascriptTag); $tagCollection->addTag($javascriptTag); @@ -85,7 +84,7 @@ public function testTagCollectionSortingOnOccurrence() $tagCollection->sort('occurrence'); $tagNames = array_map( - function (Tag $tag) { + function (Tagcloud\Tag $tag) { return $tag->getName(); }, $tagCollection->getTags() @@ -102,7 +101,7 @@ public function testTagCollectionSortingOnName() $tagCollection->sort('name'); $tagNames = array_map( - function (Tag $tag) { + function (Tagcloud\Tag $tag) { return $tag->getName(); }, $tagCollection->getTags() @@ -123,7 +122,7 @@ public function testTagCollectionSortingShuffle() public function testTagCollectionInvalidSortOrder() { - $this->expectException(TagcloudBuilder\Exceptions\InvalidSortOrderException::class); + $this->expectException(Tagcloud\Exceptions\InvalidSortOrderException::class); $tagCollection = $this->getBaseTagCollection(); $tagCollection->sort('something'); @@ -135,7 +134,7 @@ public function testTagCollectionFilter() $tagCollection->removeTags(['PHP']); $tagNames = array_map( - function (Tag $tag) { + function (Tagcloud\Tag $tag) { return $tag->getName(); }, $tagCollection->getTags() @@ -153,7 +152,7 @@ public function testTagCollectionLimit() $tagCollection->limit(2); $tagNames = array_map( - function (Tag $tag) { + function (Tagcloud\Tag $tag) { return $tag->getName(); }, $tagCollection->getTags() @@ -171,7 +170,7 @@ public function testTagCollectionWithoutLimit() $tagCollection->limit(-1); $tagNames = array_map( - function (Tag $tag) { + function (Tagcloud\Tag $tag) { return $tag->getName(); }, $tagCollection->getTags() diff --git a/tests/unit/TagTest.php b/tests/unit/TagTest.php index 540e4dc..d0308ea 100644 --- a/tests/unit/TagTest.php +++ b/tests/unit/TagTest.php @@ -1,7 +1,7 @@ assertInstanceOf(TagcloudBuilder\Tag::class, $item); + $this->assertInstanceOf(Tagcloud\Tag::class, $item); $this->assertSame($name, $item->getName()); $this->assertSame($link, $item->getLink()); $this->assertTrue($item->hasLink()); @@ -24,9 +24,9 @@ public function testItemWithDefaults() { $name = 'Google'; - $item = new TagcloudBuilder\Tag($name); + $item = new Tagcloud\Tag($name); - $this->assertInstanceOf(TagcloudBuilder\Tag::class, $item); + $this->assertInstanceOf(Tagcloud\Tag::class, $item); $this->assertSame($name, $item->getName()); $this->assertNull($item->getLink()); $this->assertFalse($item->hasLink()); @@ -35,8 +35,8 @@ public function testItemWithDefaults() public function testItemWithInvalidTarget() { - $this->expectException(TagcloudBuilder\Exceptions\InvalidLinkException::class); + $this->expectException(Tagcloud\Exceptions\InvalidLinkException::class); - new TagcloudBuilder\Tag('test', 'test'); + new Tagcloud\Tag('test', 'test'); } }