diff --git a/Controller/ContentController.php b/Controller/ContentController.php index 52cc013..9713f58 100644 --- a/Controller/ContentController.php +++ b/Controller/ContentController.php @@ -16,8 +16,6 @@ /** * Controller for content pages. - * - * @SuppressWarnings(UnusedFormalParameter) */ class ContentController extends Controller { diff --git a/Document/AbstractCdnObject.php b/Document/AbstractCdnObject.php new file mode 100644 index 0000000..f42d498 --- /dev/null +++ b/Document/AbstractCdnObject.php @@ -0,0 +1,45 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace ONGR\ContentBundle\Document; + +use ONGR\ElasticsearchBundle\Annotation as ES; + +/** + * Object used for documents which require CdnObject standard fields. + * + * @ES\Object + */ +abstract class AbstractCdnObject +{ + /** + * @var string + * + * @ES\Property(name="cdn_url", type="string") + */ + private $cdnUrl; + + /** + * @param string $cdnUrl + */ + public function setCdnUrl($cdnUrl) + { + $this->cdnUrl = $cdnUrl; + } + + /** + * @return string + */ + public function getCdnUrl() + { + return $this->cdnUrl; + } +} diff --git a/Document/AbstractImageNested.php b/Document/AbstractImageNested.php new file mode 100644 index 0000000..7702606 --- /dev/null +++ b/Document/AbstractImageNested.php @@ -0,0 +1,91 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace ONGR\ContentBundle\Document; + +use ONGR\ElasticsearchBundle\Annotation as ES; + +/** + * Nested used for documents which require ImageNested standard fields. + * + * @ES\Nested + */ +abstract class AbstractImageNested +{ + /** + * @var string + * + * @ES\Property(name="url", type="string") + */ + private $url; + + /** + * @var string + * + * @ES\Property(name="title", type="string", index="no") + */ + private $title; + + /** + * @var string + * + * @ES\Property(name="description", type="string", index="no") + */ + private $description; + + /** + * @param string $url + */ + public function setUrl($url) + { + $this->url = $url; + } + + /** + * @return string + */ + public function getUrl() + { + return $this->url; + } + + /** + * @param string $title + */ + public function setTitle($title) + { + $this->title = $title; + } + + /** + * @return string + */ + public function getTitle() + { + return $this->title; + } + + /** + * @param string $description + */ + public function setDescription($description) + { + $this->description = $description; + } + + /** + * @return string + */ + public function getDescription() + { + return $this->description; + } +} diff --git a/Document/AbstractUrlObject.php b/Document/AbstractUrlObject.php new file mode 100644 index 0000000..06d6872 --- /dev/null +++ b/Document/AbstractUrlObject.php @@ -0,0 +1,68 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace ONGR\ContentBundle\Document; + +use ONGR\ElasticsearchBundle\Annotation as ES; + +/** + * Object used for documents which require UrlObject standard fields. + * + * @ES\Object + */ +abstract class AbstractUrlObject +{ + /** + * @var string + * + * @ES\Property(name="url", type="string") + */ + private $url; + + /** + * @var string + * + * @ES\Property(name="key", type="string", index="no") + */ + private $urlKey; + + /** + * @return string + */ + public function getUrl() + { + return $this->url; + } + + /** + * @param string $url + */ + public function setUrl($url) + { + $this->url = $url; + } + + /** + * @param string $urlKey + */ + public function setUrlKey($urlKey) + { + $this->urlKey = $urlKey; + } + + /** + * @return string + */ + public function getUrlKey() + { + return $this->urlKey; + } +} diff --git a/Document/CategoryDocument.php b/Document/CategoryDocument.php new file mode 100755 index 0000000..f1560d0 --- /dev/null +++ b/Document/CategoryDocument.php @@ -0,0 +1,436 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace ONGR\ContentBundle\Document; + +use ONGR\ElasticsearchBundle\Annotation as ES; +use ONGR\ElasticsearchBundle\Document\DocumentInterface; +use ONGR\ElasticsearchBundle\Document\DocumentTrait; +use ONGR\RouterBundle\Document\SeoAwareTrait; + +/** + * Category document with standard fields. + * + * @ES\Document(create=false) + */ +abstract class CategoryDocument implements DocumentInterface +{ + use DocumentTrait; + use SeoAwareTrait; + + /** + * @var string + * + * @ES\Property(type="string", name="sort") + */ + private $sort; + + /** + * @var bool + * + * @ES\Property(type="boolean", name="is_active") + */ + private $active; + + /** + * @var string + * + * @ES\Property(type="string", name="parent_id") + */ + private $parentId; + + /** + * @var int + * + * @ES\Property(type="integer", name="level") + */ + private $level; + + /** + * @var string + * + * @ES\Property(type="string", name="title", index="not_analyzed") + */ + private $title; + + /** + * @var bool + * + * @ES\Property(type="boolean", name="is_hidden") + */ + private $hidden; + + /** + * @var int + * + * @ES\Property(type="integer", name="left") + */ + private $left; + + /** + * @var int + * + * @ES\Property(type="integer", name="right") + */ + private $right; + + /** + * @var bool + */ + private $expanded; + + /** + * @var bool + */ + private $current; + + /** + * @var array + */ + private $breadcrumbs; + + /** + * @var CategoryDocument[]|\Iterator + */ + private $children; + + /** + * Tests if category has any children. + * + * @return bool + */ + public function hasChildren() + { + return is_array($this->children) && count($this->children); + } + + /** + * Tests if category has any visible children. + * + * @return bool + */ + public function hasVisibleChildren() + { + if (is_array($this->children) && count($this->children)) { + foreach ($this->children as $child) { + if (!$child->isHidden()) { + return true; + } + } + } + + return false; + } + + /** + * @param CategoryDocument[]|\Iterator $children + */ + public function setChildren($children) + { + $this->children = $children; + } + + /** + * @return CategoryDocument[]|\Iterator + */ + public function getChildren() + { + return $this->children; + } + + /** + * @param string $key + * + * @return mixed + */ + public function getChild($key) + { + return $this->children[$key]; + } + + /** + * If key is null value is put to the end. + * + * @param CategoryDocument|\Iterator $value + * @param string $key + */ + public function setChild($value, $key = null) + { + if (empty($key)) { + $this->children[] = $value; + } else { + $this->children[$key] = $value; + } + } + + /** + * Adds child to the end of children array. + * + * @param CategoryDocument|\Iterator $value + */ + public function addChild($value) + { + $this->setChild($value); + } + + /** + * Tests if category has any breadcrumbs. + * + * @return bool + */ + public function hasBreadcrumbs() + { + return is_array($this->breadcrumbs) && count($this->breadcrumbs); + } + + /** + * @param string $key + * + * @return mixed + */ + public function getBreadcrumb($key) + { + return $this->breadcrumbs[$key]; + } + + /** + * If key is null value is put to the end. + * + * @param mixed $value + * @param string $key + */ + public function setBreadcrumb($value, $key = null) + { + if (empty($key)) { + $this->breadcrumbs[] = $value; + } else { + $this->breadcrumbs[$key] = $value; + } + } + + /** + * Add breadcrumb to end of breadcrumbs array. + * + * @param mixed $value + */ + public function addBreadcrumb($value) + { + $this->setBreadcrumb($value); + } + + /** + * @return array + */ + public function getBreadcrumbs() + { + return $this->breadcrumbs; + } + + /** + * @param array $breadcrumbs + */ + public function setBreadcrumbs($breadcrumbs) + { + $this->breadcrumbs = $breadcrumbs; + } + + /** + * @return string + */ + public function getSort() + { + return $this->sort; + } + + /** + * @param string $sort + */ + public function setSort($sort) + { + $this->sort = $sort; + } + + /** + * @return bool + */ + public function isActive() + { + return $this->active; + } + + /** + * @return bool + */ + public function getActive() + { + return $this->isActive(); + } + + /** + * @param bool $state + */ + public function setActive($state) + { + $this->active = $state; + } + + /** + * @param string $parentId + */ + public function setParentId($parentId) + { + $this->parentId = $parentId; + } + + /** + * @return string + */ + public function getParentId() + { + return $this->parentId; + } + + /** + * @param bool $current + */ + public function setCurrent($current) + { + $this->current = $current; + } + + /** + * @return bool + */ + public function getCurrent() + { + return $this->isCurrent(); + } + + /** + * @return bool + */ + public function isCurrent() + { + return $this->current; + } + + /** + * @param bool $state + */ + public function setExpanded($state) + { + $this->expanded = $state; + } + + /** + * @return bool + */ + public function getExpanded() + { + return $this->isExpanded(); + } + + /** + * @return bool + */ + public function isExpanded() + { + return $this->expanded; + } + + /** + * @param int $level + */ + public function setLevel($level) + { + $this->level = $level; + } + + /** + * @return int + */ + public function getLevel() + { + return $this->level; + } + + /** + * @return string + */ + public function getTitle() + { + return $this->title; + } + + /** + * @param string $title + */ + public function setTitle($title) + { + $this->title = $title; + } + + /** + * @return bool + */ + public function isHidden() + { + return $this->hidden; + } + + /** + * @return bool + */ + public function getHidden() + { + return $this->isHidden(); + } + + /** + * @param bool $state + */ + public function setHidden($state) + { + $this->hidden = $state; + } + + /** + * @return int + */ + public function getLeft() + { + return $this->left; + } + + /** + * @param int $left + */ + public function setLeft($left) + { + $this->left = $left; + } + + /** + * @return int + */ + public function getRight() + { + return $this->right; + } + + /** + * @param int $right + */ + public function setRight($right) + { + $this->right = $right; + } +} diff --git a/Document/ContentDocument.php b/Document/ContentDocument.php new file mode 100644 index 0000000..cf46bd8 --- /dev/null +++ b/Document/ContentDocument.php @@ -0,0 +1,97 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace ONGR\ContentBundle\Document; + +use ONGR\ElasticsearchBundle\Annotation as ES; +use ONGR\ElasticsearchBundle\Document\DocumentInterface; +use ONGR\ElasticsearchBundle\Document\DocumentTrait; +use ONGR\RouterBundle\Document\SeoAwareTrait; + +/** + * Content document with standard fields. + * + * @ES\Document(create=false) + */ +abstract class ContentDocument implements DocumentInterface +{ + use DocumentTrait; + use SeoAwareTrait; + + /** + * @var string + * + * @ES\Property(type="string", name="slug", index="not_analyzed") + */ + private $slug; + + /** + * @var string + * + * @ES\Property(type="string", name="title", index="not_analyzed") + */ + private $title; + + /** + * @var string + * + * @ES\Property(type="string", name="content") + */ + private $content; + + /** + * @return string + */ + public function getSlug() + { + return $this->slug; + } + + /** + * @param string $slug + */ + public function setSlug($slug) + { + $this->slug = $slug; + } + + /** + * @return string + */ + public function getTitle() + { + return $this->title; + } + + /** + * @param string $title + */ + public function setTitle($title) + { + $this->title = $title; + } + + /** + * @return string + */ + public function getContent() + { + return $this->content; + } + + /** + * @param string $content + */ + public function setContent($content) + { + $this->content = $content; + } +} diff --git a/Document/ProductDocument.php b/Document/ProductDocument.php new file mode 100644 index 0000000..95f0578 --- /dev/null +++ b/Document/ProductDocument.php @@ -0,0 +1,141 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace ONGR\ContentBundle\Document; + +use ONGR\ElasticsearchBundle\Annotation as ES; +use ONGR\ElasticsearchBundle\Document\DocumentInterface; +use ONGR\ElasticsearchBundle\Document\DocumentTrait; + +/** + * Product document with standard fields. + * + * @ES\Document(create=false) + */ +abstract class ProductDocument implements DocumentInterface +{ + use DocumentTrait; + + /** + * @var string + * + * @ES\Property(type="string", name="title", fields={@ES\MultiField(name="raw", type="string")}) + */ + private $title; + + /** + * @var string + * + * @ES\Property(type="string", name="description") + */ + private $description; + + /** + * @var string + * + * @ES\Property(type="string", name="long_description") + */ + private $longDescription; + + /** + * @var string + * + * @ES\Property(type="string", name="sku") + */ + private $sku; + + /** + * @var float + * + * @ES\Property(type="float", name="price") + */ + private $price; + + /** + * @return string + */ + public function getTitle() + { + return $this->title; + } + + /** + * @param string $title + */ + public function setTitle($title) + { + $this->title = $title; + } + + /** + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * @param string $description + */ + public function setDescription($description) + { + $this->description = $description; + } + + /** + * @return float + */ + public function getPrice() + { + return $this->price; + } + + /** + * @param float $price + */ + public function setPrice($price) + { + $this->price = $price; + } + + /** + * @return string + */ + public function getLongDescription() + { + return $this->longDescription; + } + + /** + * @param string $longDescription + */ + public function setLongDescription($longDescription) + { + $this->longDescription = $longDescription; + } + + /** + * @return string + */ + public function getSku() + { + return $this->sku; + } + + /** + * @param string $sku + */ + public function setSku($sku) + { + $this->sku = $sku; + } +} diff --git a/Document/Traits/CategoryTrait.php b/Document/Traits/CategoryTrait.php index 8a1b78e..687d6f5 100755 --- a/Document/Traits/CategoryTrait.php +++ b/Document/Traits/CategoryTrait.php @@ -13,6 +13,8 @@ /** * Trait used for documents which require Category standard fields. + * + * @deprecated Will be removed in stable version. Use CategoryDocument instead. */ trait CategoryTrait { diff --git a/Document/Traits/CdnObjectTrait.php b/Document/Traits/CdnObjectTrait.php index 0653df2..b6e0405 100644 --- a/Document/Traits/CdnObjectTrait.php +++ b/Document/Traits/CdnObjectTrait.php @@ -15,6 +15,8 @@ /** * Trait used for documents which require CdnObject standard fields. + * + * @deprecated Will be removed in stable version. Use AbstractCdnObject instead. */ trait CdnObjectTrait { diff --git a/Document/Traits/ContentTrait.php b/Document/Traits/ContentTrait.php index 6cc6fe3..270682a 100644 --- a/Document/Traits/ContentTrait.php +++ b/Document/Traits/ContentTrait.php @@ -15,6 +15,8 @@ /** * Trait used for documents which require Content standard fields. + * + * @deprecated Will be removed in stable version. Use ContentDocument instead. */ trait ContentTrait { diff --git a/Document/Traits/ImagesNestedTrait.php b/Document/Traits/ImagesNestedTrait.php index 078c258..b5a3a7a 100644 --- a/Document/Traits/ImagesNestedTrait.php +++ b/Document/Traits/ImagesNestedTrait.php @@ -15,6 +15,8 @@ /** * Trait used for documents which require ImagesNested standard fields. + * + * @deprecated Will be removed in stable version. Use AbstractImageNested instead. */ trait ImagesNestedTrait { diff --git a/Document/Traits/ProductTrait.php b/Document/Traits/ProductTrait.php index 22dd6e0..034c7b3 100644 --- a/Document/Traits/ProductTrait.php +++ b/Document/Traits/ProductTrait.php @@ -15,6 +15,8 @@ /** * Trait used for documents which require Product standard fields. + * + * @deprecated Will be removed in stable version. Use ProductDocument instead. */ trait ProductTrait { diff --git a/Document/Traits/UrlObjectTrait.php b/Document/Traits/UrlObjectTrait.php index cab4f67..85a59f6 100644 --- a/Document/Traits/UrlObjectTrait.php +++ b/Document/Traits/UrlObjectTrait.php @@ -15,6 +15,8 @@ /** * Trait used for documents which require UrlObject standard fields. + * + * @deprecated Will be removed in stable version. Use AbstractUrlObject instead. */ trait UrlObjectTrait { diff --git a/Service/CategoryService.php b/Service/CategoryService.php index 5927630..22dce09 100755 --- a/Service/CategoryService.php +++ b/Service/CategoryService.php @@ -11,9 +11,8 @@ namespace ONGR\ContentBundle\Service; -use ONGR\ContentBundle\Document\Traits\CategoryTrait; +use ONGR\ContentBundle\Document\CategoryDocument; use ONGR\ElasticsearchBundle\Document\DocumentInterface; -use ONGR\ElasticsearchBundle\Document\DocumentTrait; use ONGR\ElasticsearchBundle\DSL\Query\TermQuery; use ONGR\ElasticsearchBundle\DSL\Search; use ONGR\ElasticsearchBundle\DSL\Sort\Sort; @@ -87,9 +86,9 @@ protected function buildQuery() /** * Builds a child node. * - * @param CategoryTrait|DocumentTrait $node - * @param \ArrayIterator $references - * @param int $maxLevel + * @param CategoryDocument $node + * @param \ArrayIterator $references + * @param int $maxLevel */ private function buildChildNode($node, $references, $maxLevel) { @@ -122,9 +121,9 @@ public function getCategory($id) /** * Builds a root node. * - * @param CategoryTrait|DocumentTrait $node - * @param \ArrayIterator $tree - * @param int $level + * @param CategoryDocument $node + * @param \ArrayIterator $tree + * @param int $level */ private function buildRootNode($node, $tree, $level) { @@ -135,10 +134,10 @@ private function buildRootNode($node, $tree, $level) /** * Builds a node. Sets node parameters. * - * @param CategoryTrait|DocumentTrait $node - * @param \ArrayIterator $references - * @param \ArrayIterator $tree - * @param int $maxLevel + * @param CategoryDocument $node + * @param \ArrayIterator $references + * @param \ArrayIterator $tree + * @param int $maxLevel */ private function buildNode($node, $references, $tree, $maxLevel) { @@ -207,7 +206,7 @@ private function buildTree($dataSet, $maxLevel = 0) */ protected function sortChildTree(&$tree) { - /** @var CategoryTrait|DocumentTrait $node */ + /** @var CategoryDocument $node */ if (is_array($tree)) { uasort($tree, [$this, 'sortNodes']); foreach ($tree as $node) { @@ -233,8 +232,8 @@ protected function sortChildTree(&$tree) /** * Sorts nodes by field sort if value equal then by field left. * - * @param CategoryTrait|DocumentTrait $a - * @param CategoryTrait|DocumentTrait $b + * @param CategoryDocument $a + * @param CategoryDocument $b * * @return int */ @@ -297,14 +296,14 @@ public function getPartialTree($maxLevel = 0, $categoryId = null) /** * Returns partial tree by category ID. * - * @param array $tree - * @param string $categoryId + * @param array|\ArrayIterator $tree + * @param string $categoryId * * @return array */ protected function findPartialTree($tree, $categoryId) { - /** @var CategoryTrait|DocumentTrait $node */ + /** @var CategoryDocument $node */ foreach ($tree as $node) { if ($node->getId() == $categoryId) { return [$node]; @@ -375,12 +374,4 @@ protected function setLoadHiddenCategories($param) { $this->loadHiddenCategories = $param; } - - /** - * @param string $categoryRootId - */ - public function setCategoryRootId($categoryRootId) - { - $this->categoryRootId = $categoryRootId; - } } diff --git a/Tests/Functional/ServiceCreationTest.php b/Tests/Functional/ServiceCreationTest.php index 2593439..48694e8 100644 --- a/Tests/Functional/ServiceCreationTest.php +++ b/Tests/Functional/ServiceCreationTest.php @@ -46,7 +46,7 @@ public function getTestServiceCreateData() return [ [ 'ongr_content.category_service', - 'ONGR\\ContentBundle\\Service\\CategoryService', + 'ONGR\ContentBundle\Service\CategoryService', ], ]; } diff --git a/Tests/Functional/Twig/ContentExtensionsTest.php b/Tests/Functional/Twig/ContentExtensionsTest.php index a900083..fa5ea22 100644 --- a/Tests/Functional/Twig/ContentExtensionsTest.php +++ b/Tests/Functional/Twig/ContentExtensionsTest.php @@ -15,6 +15,8 @@ use ONGR\ElasticsearchBundle\Test\ElasticsearchTestCase; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\RequestStack; +use Symfony\Component\HttpKernel\Fragment\FragmentHandler; +use Symfony\Component\Routing\RouterInterface; class ContentExtensionsTest extends ElasticsearchTestCase { @@ -89,8 +91,10 @@ public function testSnippetFunction($request, $slug, $expectedContent, $strategy $requestStack->push($request); } + /** @var FragmentHandler $handler */ $handler = $this->getContainer()->get('fragment.handler'); $handler->setRequest($request); + /** @var RouterInterface $router */ $router = $this->getContainer()->get('router'); $repository = $this->getManager()->getRepository('AcmeTestBundle:Content'); diff --git a/Tests/Unit/Document/CdnObjectTraitTest.php b/Tests/Unit/Document/AbstractCdnObjectTest.php similarity index 65% rename from Tests/Unit/Document/CdnObjectTraitTest.php rename to Tests/Unit/Document/AbstractCdnObjectTest.php index 5ca6c8d..93bd620 100644 --- a/Tests/Unit/Document/CdnObjectTraitTest.php +++ b/Tests/Unit/Document/AbstractCdnObjectTest.php @@ -11,19 +11,19 @@ namespace ONGR\ContentBundle\Tests\Unit\Document; -use ONGR\ContentBundle\Document\Traits\CdnObjectTrait; +use ONGR\ContentBundle\Document\AbstractCdnObject; /** * Provides tests for cdn object. */ -class CdnObjectTraitTest extends \PHPUnit_Framework_TestCase +class AbstractCdnObjectTest extends \PHPUnit_Framework_TestCase { /** - * Provides data for testCdnTrait(). + * Provides data for testCdnObject(). * * @return array */ - public function cdnTraitDataProvider() + public function cdnObjectDataProvider() { $data = [ [ @@ -42,16 +42,16 @@ public function cdnTraitDataProvider() } /** - * Tests cnd trait. + * Tests cnd object. * * @param array $data * - * @dataProvider cdnTraitDataProvider() + * @dataProvider cdnObjectDataProvider() */ - public function testCdnTrait(array $data) + public function testCdnObject(array $data) { - /** @var CdnObjectTrait $cdn */ - $cdn = $this->getMockForTrait('ONGR\\ContentBundle\\Document\\Traits\\CdnObjectTrait'); + /** @var AbstractCdnObject $cdn */ + $cdn = $this->getMock('ONGR\ContentBundle\Document\AbstractCdnObject', null); $cdn->setCdnUrl($data['cdn_url']); $this->assertEquals($data['cdn_url'], $cdn->getCdnUrl()); } diff --git a/Tests/Unit/Document/ImagesNestedTraitTest.php b/Tests/Unit/Document/AbstractImageNestedTest.php similarity index 70% rename from Tests/Unit/Document/ImagesNestedTraitTest.php rename to Tests/Unit/Document/AbstractImageNestedTest.php index 0f1ead7..16d8d48 100644 --- a/Tests/Unit/Document/ImagesNestedTraitTest.php +++ b/Tests/Unit/Document/AbstractImageNestedTest.php @@ -11,19 +11,19 @@ namespace ONGR\ContentBundle\Tests\Unit\Document; -use ONGR\ContentBundle\Document\Traits\ImagesNestedTrait; +use ONGR\ContentBundle\Document\AbstractImageNested; /** - * Provides tests for imagesNested document. + * Provides tests for imageNested document. */ -class ImagesNestedTraitTest extends \PHPUnit_Framework_TestCase +class AbstractImageNestedTest extends \PHPUnit_Framework_TestCase { /** - * Provides data for testImagesNestedTrait(). + * Provides data for testImageNested(). * * @return array */ - public function imagesNestedTraitDataProvider() + public function imageNestedDataProvider() { $data = [ [ @@ -46,16 +46,16 @@ public function imagesNestedTraitDataProvider() } /** - * Tests imagesNested trait. + * Tests imageNested. * * @param array $data * - * @dataProvider imagesNestedTraitDataProvider() + * @dataProvider imageNestedDataProvider() */ - public function testImagesNestedTrait(array $data) + public function testImageNested(array $data) { - /** @var ImagesNestedTrait $imagesNested */ - $imagesNested = $this->getMockForTrait('ONGR\\ContentBundle\\Document\\Traits\\ImagesNestedTrait'); + /** @var AbstractImageNested $imagesNested */ + $imagesNested = $this->getMock('ONGR\ContentBundle\Document\AbstractImageNested', null); $imagesNested->setUrl($data['url']); $this->assertEquals($data['url'], $imagesNested->getUrl()); diff --git a/Tests/Unit/Document/UrlObjectTraitTest.php b/Tests/Unit/Document/AbstractUrlObjectTest.php similarity index 69% rename from Tests/Unit/Document/UrlObjectTraitTest.php rename to Tests/Unit/Document/AbstractUrlObjectTest.php index 82430d5..878b8a6 100644 --- a/Tests/Unit/Document/UrlObjectTraitTest.php +++ b/Tests/Unit/Document/AbstractUrlObjectTest.php @@ -11,19 +11,19 @@ namespace ONGR\ContentBundle\Tests\Unit\Document; -use ONGR\ContentBundle\Document\Traits\UrlObjectTrait; +use ONGR\ContentBundle\Document\AbstractUrlObject; /** * Provides tests for url object. */ -class UrlObjectTraitTest extends \PHPUnit_Framework_TestCase +class AbstractUrlObjectTest extends \PHPUnit_Framework_TestCase { /** - * Provides data for testUrlTrait(). + * Provides data for testUrlObject(). * * @return array */ - public function urlTraitDataProvider() + public function urlObjectDataProvider() { $data = [ [ @@ -44,16 +44,16 @@ public function urlTraitDataProvider() } /** - * Tests url trait. + * Tests url object. * * @param array $data * - * @dataProvider urlTraitDataProvider() + * @dataProvider urlObjectDataProvider() */ - public function testUrlTrait(array $data) + public function testUrlObject(array $data) { - /** @var UrlObjectTrait $url */ - $url = $this->getMockForTrait('ONGR\\ContentBundle\\Document\\Traits\\UrlObjectTrait'); + /** @var AbstractUrlObject $url */ + $url = $this->getMock('ONGR\ContentBundle\Document\AbstractUrlObject', null); $url->setUrl($data['url']); $this->assertEquals($data['url'], $url->getUrl()); diff --git a/Tests/Unit/Document/CategoryTraitTest.php b/Tests/Unit/Document/CategoryDocumentTest.php similarity index 79% rename from Tests/Unit/Document/CategoryTraitTest.php rename to Tests/Unit/Document/CategoryDocumentTest.php index a1806d8..9f41133 100644 --- a/Tests/Unit/Document/CategoryTraitTest.php +++ b/Tests/Unit/Document/CategoryDocumentTest.php @@ -11,19 +11,19 @@ namespace ONGR\ContentBundle\Tests\Unit\Document; -use ONGR\ContentBundle\Document\Traits\CategoryTrait; +use ONGR\ContentBundle\Document\CategoryDocument; /** - * Provides tests for category trait. + * Provides tests for category document. */ -class CategoryTraitTest extends \PHPUnit_Framework_TestCase +class CategoryDocumentTest extends \PHPUnit_Framework_TestCase { /** - * Provides data for testCategoryTrait(). + * Provides data for testCategoryDocument(). * * @return array */ - public function categoryTraitDataProvider() + public function categoryDocumentDataProvider() { $catData = [ [ @@ -33,7 +33,7 @@ public function categoryTraitDataProvider() 'left' => 2, 'right' => 5, 'level' => 2, - 'parent_id' => 'oxrootid', + 'parent_id' => 'testrootid', 'hidden' => false, 'title' => 'cat1', 'expanded' => false, @@ -48,7 +48,7 @@ public function categoryTraitDataProvider() 'left' => 2, 'right' => 5, 'level' => 3, - 'parent_id' => 'oxrootid', + 'parent_id' => 'testrootid', 'hidden' => true, 'title' => 'cat2', 'expanded' => true, @@ -62,16 +62,16 @@ public function categoryTraitDataProvider() } /** - * Tests Category trait. + * Tests Category document. * * @param array $data * - * @dataProvider categoryTraitDataProvider() + * @dataProvider categoryDocumentDataProvider() */ - public function testCategoryTrait(array $data) + public function testCategoryDocument(array $data) { - /** @var CategoryTrait $cat */ - $cat = $this->getMockForTrait('ONGR\\ContentBundle\\Document\\Traits\\CategoryTrait'); + /** @var CategoryDocument $cat */ + $cat = $this->getMockForAbstractClass('ONGR\ContentBundle\Document\CategoryDocument'); $cat->setActive($data['active']); $this->assertEquals($data['active'], $cat->isActive()); $this->assertEquals($data['active'], $cat->getActive()); @@ -115,8 +115,8 @@ public function testCategoryTrait(array $data) $this->assertEquals(false, $cat->hasChildren()); $this->assertEquals(false, $cat->hasVisibleChildren()); - /** @var CategoryTrait $cat2 */ - $cat2 = $this->getMockForTrait('ONGR\\ContentBundle\\Document\\Traits\\CategoryTrait'); + /** @var CategoryDocument $cat2 */ + $cat2 = $this->getMockForAbstractClass('ONGR\ContentBundle\Document\CategoryDocument'); $cat2->setHidden(false); $cat->addChild($cat2); $this->assertEquals(true, $cat->hasVisibleChildren()); @@ -124,8 +124,8 @@ public function testCategoryTrait(array $data) $this->assertEquals(false, $cat2->isHidden()); $this->assertEquals(false, $cat2->getHidden()); - /** @var CategoryTrait $cat3 */ - $cat3 = $this->getMockForTrait('ONGR\\ContentBundle\\Document\\Traits\\CategoryTrait'); + /** @var CategoryDocument $cat3 */ + $cat3 = $this->getMockForAbstractClass('ONGR\ContentBundle\Document\CategoryDocument'); $cat3->setHidden(true); $cat2->addChild($cat3); $this->assertEquals(false, $cat2->hasVisibleChildren()); diff --git a/Tests/Unit/Document/ContentTraitTest.php b/Tests/Unit/Document/ContentDocumentTest.php similarity index 72% rename from Tests/Unit/Document/ContentTraitTest.php rename to Tests/Unit/Document/ContentDocumentTest.php index ce04601..0d5a347 100644 --- a/Tests/Unit/Document/ContentTraitTest.php +++ b/Tests/Unit/Document/ContentDocumentTest.php @@ -11,19 +11,19 @@ namespace ONGR\ContentBundle\Tests\Unit\Document; -use ONGR\ContentBundle\Document\Traits\ContentTrait; +use ONGR\ContentBundle\Document\ContentDocument; /** * Provides tests for content document. */ -class ContentTraitTest extends \PHPUnit_Framework_TestCase +class ContentDocumentTest extends \PHPUnit_Framework_TestCase { /** - * Provides data for testContentTrait(). + * Provides data for testContentDocument(). * * @return array */ - public function contentTraitDataProvider() + public function contentDocumentDataProvider() { $data = [ [ @@ -46,16 +46,16 @@ public function contentTraitDataProvider() } /** - * Tests content trait. + * Tests content document. * * @param array $data * - * @dataProvider contentTraitDataProvider() + * @dataProvider contentDocumentDataProvider() */ - public function testContentTrait(array $data) + public function testContentDocument(array $data) { - /** @var ContentTrait $content */ - $content = $this->getMockForTrait('ONGR\\ContentBundle\\Document\\Traits\\ContentTrait'); + /** @var ContentDocument $content */ + $content = $this->getMockForAbstractClass('ONGR\ContentBundle\Document\ContentDocument'); $content->setSlug($data['slug']); $this->assertEquals($data['slug'], $content->getSlug()); diff --git a/Tests/Unit/Document/ProductTraitTest.php b/Tests/Unit/Document/ProductDocumentTest.php similarity index 78% rename from Tests/Unit/Document/ProductTraitTest.php rename to Tests/Unit/Document/ProductDocumentTest.php index 5f00d3b..9bfd411 100644 --- a/Tests/Unit/Document/ProductTraitTest.php +++ b/Tests/Unit/Document/ProductDocumentTest.php @@ -11,19 +11,19 @@ namespace ONGR\ContentBundle\Tests\Unit\Document; -use ONGR\ContentBundle\Document\Traits\ProductTrait; +use ONGR\ContentBundle\Document\ProductDocument; /** * Provides tests for product document. */ -class ProductTraitTest extends \PHPUnit_Framework_TestCase +class ProductDocumentTest extends \PHPUnit_Framework_TestCase { /** - * Provides data for testProductTrait(). + * Provides data for testProductDocument(). * * @return array */ - public function productTraitDataProvider() + public function productDocumentDataProvider() { $data = [ [ @@ -50,16 +50,16 @@ public function productTraitDataProvider() } /** - * Tests product trait. + * Tests product document. * * @param array $data * - * @dataProvider productTraitDataProvider() + * @dataProvider productDocumentDataProvider() */ - public function testProductTrait(array $data) + public function testProductDocument(array $data) { - /** @var ProductTrait $product */ - $product = $this->getMockForTrait('ONGR\\ContentBundle\\Document\\Traits\\ProductTrait'); + /** @var ProductDocument $product */ + $product = $this->getMockForAbstractClass('ONGR\ContentBundle\Document\ProductDocument'); $product->setTitle($data['title']); $this->assertEquals($data['title'], $product->getTitle()); diff --git a/Tests/Unit/Service/CategoryServiceTest.php b/Tests/Unit/Service/CategoryServiceTest.php index acde7af..cd2046c 100644 --- a/Tests/Unit/Service/CategoryServiceTest.php +++ b/Tests/Unit/Service/CategoryServiceTest.php @@ -132,11 +132,11 @@ protected function getDataArray() */ protected function getTestDataService() { - $repository = $this->getMockBuilder('ElasticsearchBundle\\ORM\\Repository') + $repository = $this->getMockBuilder('ElasticsearchBundle\ORM\Repository') ->disableOriginalConstructor() ->getMock(); - $manager = $this->getMockBuilder('ElasticsearchBundle\\ORM\\Manager') + $manager = $this->getMockBuilder('ElasticsearchBundle\ORM\Manager') ->disableOriginalConstructor() ->getMock(); $manager->expects($this->any()) @@ -178,9 +178,7 @@ protected function buildCategory($category) $cat->setLeft($category['left']); $cat->setParentId($category['parent_id']); $cat->setLevel($category['level']); - if (isset($category['is_hidden'])) { - $cat->setHidden($category['is_hidden']); - } + isset($category['is_hidden']) && $cat->setHidden($category['is_hidden']); isset($category['is_current']) && $cat->setCurrent($category['is_current']); isset($category['is_expanded']) && $cat->setExpanded($category['is_expanded']); diff --git a/Tests/Unit/Service/ContentServiceTest.php b/Tests/Unit/Service/ContentServiceTest.php index e0ae686..c4476df 100644 --- a/Tests/Unit/Service/ContentServiceTest.php +++ b/Tests/Unit/Service/ContentServiceTest.php @@ -13,6 +13,8 @@ use ONGR\ContentBundle\Service\ContentService; use ONGR\ElasticsearchBundle\DSL\Query\TermQuery; +use ONGR\ElasticsearchBundle\ORM\Repository; +use Psr\Log\LoggerInterface; class ContentServiceTest extends \PHPUnit_Framework_TestCase { @@ -30,6 +32,7 @@ public function testGetDocumentBySlug() 'must' ); + /** @var Repository|\PHPUnit_Framework_MockObject_MockObject $repositoryMock */ $repositoryMock = $this ->getMockBuilder('ElasticsearchBundle\ORM\Repository') ->disableOriginalConstructor() @@ -67,6 +70,7 @@ public function testGetDocumentBySlugLogger() 'must' ); + /** @var Repository|\PHPUnit_Framework_MockObject_MockObject $repositoryMock */ $repositoryMock = $this ->getMockBuilder('ElasticsearchBundle\ORM\Repository') ->disableOriginalConstructor() @@ -84,7 +88,8 @@ public function testGetDocumentBySlugLogger() ->with() ->will($this->returnValue(new \ArrayIterator([]))); - $loggerMock = $this->getMock('Psr\\Log\\LoggerInterface'); + /** @var LoggerInterface|\PHPUnit_Framework_MockObject_MockObject $loggerMock */ + $loggerMock = $this->getMock('Psr\Log\LoggerInterface'); $loggerMock ->expects($this->once()) ->method('warning') diff --git a/Tests/Unit/Twig/CategoryExtensionTest.php b/Tests/Unit/Twig/CategoryExtensionTest.php index 7af4656..7203183 100755 --- a/Tests/Unit/Twig/CategoryExtensionTest.php +++ b/Tests/Unit/Twig/CategoryExtensionTest.php @@ -14,6 +14,7 @@ use ONGR\ContentBundle\Service\CategoryService; use ONGR\ContentBundle\Twig\CategoryExtension; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; +use Twig_Environment; class CategoryExtensionTest extends WebTestCase { @@ -72,6 +73,7 @@ public function testRenderCategoryTree() $template = 'testTemplate'; $expected = 'testStr'; + /** @var Twig_Environment|\PHPUnit_Framework_MockObject_MockObject $environment */ $environment = $this->getMock('Twig_Environment', ['render']); $environment->expects($this->once()) ->method('render') @@ -104,6 +106,7 @@ public function testGetCategoryTree() $tree = [1]; $categoryDocument = new \stdClass(); + /** @var Twig_Environment|\PHPUnit_Framework_MockObject_MockObject $environment */ $environment = $this->getMock('Twig_Environment', ['render']); $environment->expects($this->once()) ->method('render') @@ -117,6 +120,7 @@ public function testGetCategoryTree() ) ->will($this->returnValue($expected)); + /** @var CategoryService|\PHPUnit_Framework_MockObject_MockObject $service */ $service = $this->getMock('stdClass', ['getTree', 'setCurrentCategoryId', 'getCurrentCategoryDocument']); $service->expects($this->once())->method('getTree')->with($maxLevel)->will($this->returnValue($tree)); $service->expects($this->once())->method('getCurrentCategoryDocument')->will( diff --git a/Tests/Unit/Twig/ContentExtensionTest.php b/Tests/Unit/Twig/ContentExtensionTest.php index 447b636..04c769c 100644 --- a/Tests/Unit/Twig/ContentExtensionTest.php +++ b/Tests/Unit/Twig/ContentExtensionTest.php @@ -13,6 +13,8 @@ use ONGR\ContentBundle\Twig\ContentExtension; use ONGR\ElasticsearchBundle\ORM\Manager; +use Symfony\Component\HttpKernel\Fragment\FragmentHandler; +use Symfony\Component\Routing\RouterInterface; /** * Provides tests for content extension. @@ -217,21 +219,21 @@ protected function getManager($result = []) } /** - * @return \PHPUnit_Framework_MockObject_MockObject + * @return FragmentHandler|\PHPUnit_Framework_MockObject_MockObject */ protected function getFragmentHandlerMock() { return $this->getMock( - 'Symfony\\Component\\HttpKernel\\Fragment\\FragmentHandler', + 'Symfony\Component\HttpKernel\Fragment\FragmentHandler', ['render'] ); } /** - * @return \PHPUnit_Framework_MockObject_MockObject + * @return RouterInterface|\PHPUnit_Framework_MockObject_MockObject */ protected function getRouterMock() { - return $this->getMock('Symfony\\Component\\Routing\\RouterInterface'); + return $this->getMock('Symfony\Component\Routing\RouterInterface'); } } diff --git a/Tests/Unit/Twig/PriceExtensionTest.php b/Tests/Unit/Twig/PriceExtensionTest.php index 148de5e..a603d07 100755 --- a/Tests/Unit/Twig/PriceExtensionTest.php +++ b/Tests/Unit/Twig/PriceExtensionTest.php @@ -15,6 +15,7 @@ use ONGR\ContentBundle\Service\Currency\CurrencyRatesService; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; use ONGR\ContentBundle\Twig\PriceExtension; +use Twig_Environment; class PriceExtensionTest extends WebTestCase { @@ -424,6 +425,8 @@ public function testPriceListFormatting($rates, $toPrintList, $formatMap, $expec $exchangeService = new CurrencyExchangeService($this->getRatesService($rates, 'EUR'), 'EUR'); $extension = new PriceExtension('EUR', '.', '', 'EUR', $formatMap, $toPrintList); $extension->setCurrencyExchangeService($exchangeService); + + /** @var Twig_Environment|\PHPUnit_Framework_MockObject_MockObject $env */ $env = $this->getMock('stdClass', ['render']); $env->expects($this->once())->method('render')->with( 'testTemplate', @@ -503,7 +506,7 @@ public function testPriceListWithCurrencyData() * @param array $rates * @param array $toPrintList * @param array $currency - * @param array $price + * @param float $price * @param array $expectedParams * * @dataProvider testPriceListWithCurrencyData @@ -513,6 +516,8 @@ public function testPriceListWithCurrency($rates, $toPrintList, $currency, $pric $exchangeService = new CurrencyExchangeService($this->getRatesService($rates, 'EUR'), 'EUR'); $extension = new PriceExtension('', '.', '', $currency, null, $toPrintList); $extension->setCurrencyExchangeService($exchangeService); + + /** @var Twig_Environment|\PHPUnit_Framework_MockObject_MockObject $env */ $env = $this->getMock('stdClass', ['render']); $env->expects($this->once())->method('render')->with( 'testTemplate', @@ -550,6 +555,8 @@ public function testPriceListWithDefaultCurrency() ], ], ]; + + /** @var Twig_Environment|\PHPUnit_Framework_MockObject_MockObject $env */ $env = $this->getMock('stdClass', ['render']); $env->expects($this->once())->method('render')->with( 'testTemplate', @@ -595,6 +602,8 @@ public function testCurrencyList() ], ], ]; + + /** @var Twig_Environment|\PHPUnit_Framework_MockObject_MockObject $env */ $env = $this->getMock('stdClass', ['render']); $env->expects($this->once())->method('render')->with( 'testTemplate', @@ -634,6 +643,8 @@ public function testCurrencyListCss() ], ], ]; + + /** @var Twig_Environment|\PHPUnit_Framework_MockObject_MockObject $env */ $env = $this->getMock('stdClass', ['render']); $env->expects($this->once())->method('render')->with( 'testTemplate', diff --git a/Tests/app/config/config_test.yml b/Tests/app/config/config_test.yml index 17ab7c3..0af87c6 100644 --- a/Tests/app/config/config_test.yml +++ b/Tests/app/config/config_test.yml @@ -16,6 +16,7 @@ monolog: type: stream action_level: error path: %kernel.logs_dir%/test.log + ongr_elasticsearch: connections: default: @@ -37,6 +38,7 @@ ongr_content: product: es.manager.default.product content: es.manager.default.content category: es.manager.default.category + ongr_router: es_manager: default seo_routes: diff --git a/Tests/app/fixture/Acme/TestBundle/Document/Category.php b/Tests/app/fixture/Acme/TestBundle/Document/Category.php index e16335b..bffcaf2 100644 --- a/Tests/app/fixture/Acme/TestBundle/Document/Category.php +++ b/Tests/app/fixture/Acme/TestBundle/Document/Category.php @@ -11,20 +11,34 @@ namespace ONGR\ContentBundle\Tests\app\fixture\Acme\TestBundle\Document; +use ONGR\ContentBundle\Document\CategoryDocument; use ONGR\ElasticsearchBundle\Annotation as ES; -use ONGR\ElasticsearchBundle\Document\DocumentInterface; -use ONGR\ElasticsearchBundle\Document\DocumentTrait; -use ONGR\ContentBundle\Document\Traits\CategoryTrait; -use ONGR\RouterBundle\Document\SeoAwareTrait; /** * Dummy category document. * * @ES\Document(type="category") */ -class Category implements DocumentInterface +class Category extends CategoryDocument { - use DocumentTrait; - use CategoryTrait; - use SeoAwareTrait; + /** + * @var UrlObject[]|\Iterator + * + * @ES\Property(name="urls", type="object", objectName="AcmeTestBundle:UrlObject", multiple=true) + */ + public $dummyUrls; + + /** + * @var CdnObject[]|\Iterator + * + * @ES\Property(name="cdn_urls", type="object", objectName="AcmeTestBundle:CdnObject", multiple=true) + */ + public $dummyCdnUrls; + + /** + * @var ImageNested[]|\Iterator + * + * @ES\Property(name="images", type="nested", objectName="AcmeTestBundle:ImageNested", multiple=true) + */ + public $dummyImagesNested; } diff --git a/Tests/app/fixture/Acme/TestBundle/Document/CdnObject.php b/Tests/app/fixture/Acme/TestBundle/Document/CdnObject.php new file mode 100644 index 0000000..e51d235 --- /dev/null +++ b/Tests/app/fixture/Acme/TestBundle/Document/CdnObject.php @@ -0,0 +1,24 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace ONGR\ContentBundle\Tests\app\fixture\Acme\TestBundle\Document; + +use ONGR\ContentBundle\Document\AbstractCdnObject; +use ONGR\ElasticsearchBundle\Annotation as ES; + +/** + * Dummy cdn object. + * + * @ES\Object + */ +class CdnObject extends AbstractCdnObject +{ +} diff --git a/Tests/app/fixture/Acme/TestBundle/Document/Content.php b/Tests/app/fixture/Acme/TestBundle/Document/Content.php index 63f26e9..cd68f16 100644 --- a/Tests/app/fixture/Acme/TestBundle/Document/Content.php +++ b/Tests/app/fixture/Acme/TestBundle/Document/Content.php @@ -11,23 +11,16 @@ namespace ONGR\ContentBundle\Tests\app\fixture\Acme\TestBundle\Document; -use ONGR\ContentBundle\Document\Traits\ContentTrait; +use ONGR\ContentBundle\Document\ContentDocument; use ONGR\ElasticsearchBundle\Annotation as ES; -use ONGR\ElasticsearchBundle\Document\DocumentInterface; -use ONGR\ElasticsearchBundle\Document\DocumentTrait; -use ONGR\RouterBundle\Document\SeoAwareTrait; /** * Dummy content document. * * @ES\Document(type="content") */ -class Content implements DocumentInterface +class Content extends ContentDocument { - use DocumentTrait; - use SeoAwareTrait; - use ContentTrait; - /** * @var string * diff --git a/Tests/app/fixture/Acme/TestBundle/Document/ImageNested.php b/Tests/app/fixture/Acme/TestBundle/Document/ImageNested.php new file mode 100644 index 0000000..f15224e --- /dev/null +++ b/Tests/app/fixture/Acme/TestBundle/Document/ImageNested.php @@ -0,0 +1,24 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace ONGR\ContentBundle\Tests\app\fixture\Acme\TestBundle\Document; + +use ONGR\ContentBundle\Document\AbstractImageNested; +use ONGR\ElasticsearchBundle\Annotation as ES; + +/** + * Dummy nested image. + * + * @ES\Nested + */ +class ImageNested extends AbstractImageNested +{ +} diff --git a/Tests/app/fixture/Acme/TestBundle/Document/Product.php b/Tests/app/fixture/Acme/TestBundle/Document/Product.php index 3464d5f..2bdd87e 100644 --- a/Tests/app/fixture/Acme/TestBundle/Document/Product.php +++ b/Tests/app/fixture/Acme/TestBundle/Document/Product.php @@ -11,18 +11,14 @@ namespace ONGR\ContentBundle\Tests\app\fixture\Acme\TestBundle\Document; -use ONGR\ContentBundle\Document\Traits\ProductTrait; +use ONGR\ContentBundle\Document\ProductDocument; use ONGR\ElasticsearchBundle\Annotation as ES; -use ONGR\ElasticsearchBundle\Document\DocumentInterface; -use ONGR\ElasticsearchBundle\Document\DocumentTrait; /** * Dummy product document. * * @ES\Document(type="product") */ -class Product implements DocumentInterface +class Product extends ProductDocument { - use DocumentTrait; - use ProductTrait; } diff --git a/Tests/app/fixture/Acme/TestBundle/Document/UrlObject.php b/Tests/app/fixture/Acme/TestBundle/Document/UrlObject.php new file mode 100644 index 0000000..affffab --- /dev/null +++ b/Tests/app/fixture/Acme/TestBundle/Document/UrlObject.php @@ -0,0 +1,24 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace ONGR\ContentBundle\Tests\app\fixture\Acme\TestBundle\Document; + +use ONGR\ContentBundle\Document\AbstractUrlObject; +use ONGR\ElasticsearchBundle\Annotation as ES; + +/** + * Dummy url object. + * + * @ES\Object + */ +class UrlObject extends AbstractUrlObject +{ +} diff --git a/Twig/CategoryExtension.php b/Twig/CategoryExtension.php index 9163fb7..225100a 100755 --- a/Twig/CategoryExtension.php +++ b/Twig/CategoryExtension.php @@ -142,11 +142,11 @@ public function getFunctions() /** * Renders category tree. * - * @param \Twig_Environment $environment - * @param array $tree - * @param string|null $selectedCategory - * @param string|null $currentCategory - * @param string|null $template + * @param \Twig_Environment $environment + * @param array|\ArrayIterator $tree + * @param string|null $selectedCategory + * @param string|null $currentCategory + * @param string|null $template * * @return null|string */ diff --git a/Twig/PriceExtension.php b/Twig/PriceExtension.php index 52a232e..19b4eb6 100755 --- a/Twig/PriceExtension.php +++ b/Twig/PriceExtension.php @@ -204,7 +204,7 @@ public function getFormattedPrice( * Returns specified prices formatted by a specified template. * * @param \Twig_Environment $environment - * @param int $price + * @param float $price * @param string $template * @param null $fromCurrency * diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 2aa5b4d..750e687 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -39,6 +39,8 @@ +