From 77600ec2ae8344c76de2ad5b90c5225bc392de5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mantas=20Jonu=C5=A1as?= <mantas.jonusas@nfq.lt> Date: Thu, 26 Feb 2015 09:57:21 +0200 Subject: [PATCH] Removed constants --- DslTypeAwareTraitTest.php | 61 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 DslTypeAwareTraitTest.php diff --git a/DslTypeAwareTraitTest.php b/DslTypeAwareTraitTest.php new file mode 100644 index 0000000..921620e --- /dev/null +++ b/DslTypeAwareTraitTest.php @@ -0,0 +1,61 @@ +<?php + +/* + * This file is part of the ONGR package. + * + * (c) NFQ Technologies UAB <info@nfq.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace ONGR\ElasticsearchBundle\Tests\Unit\DSL; + +use ONGR\ElasticsearchBundle\DSL\DslTypeAwareTrait; + +/** + * Test for DslTypeAwareTrait. + */ +class DslTypeAwareTraitTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var DslTypeAwareTrait + */ + private $mock; + + /** + * {@inheritdoc} + */ + public function setUp() + { + $this->mock = $this->getMockForTrait('ONGR\ElasticsearchBundle\DSL\DslTypeAwareTrait'); + } + + /** + * Tests if setDslType throws exception. + * + * @expectedException \InvalidArgumentException + */ + public function testIfSetDslTypeExceptionThrowsException() + { + $this->mock->setDslType('foo'); + } + + /** + * Tests if setDslType sets filter. + */ + public function testIfSetDslTypeSetsFilter() + { + $this->mock->setDslType('filter'); + $this->assertEquals('filter', $this->mock->getDslType()); + } + + /** + * Tests if setDslType sets query. + */ + public function testIfSetDslTypeSetsQuery() + { + $this->mock->setDslType('query'); + $this->assertEquals('query', $this->mock->getDslType()); + } +} -- GitLab