for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of the FOSElasticaBundle package.
*
* (c) FriendsOfSymfony <http://friendsofsymfony.github.com/>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* This file is part of the FOSElasticaBundle project.
* (c) Tim Nagel <[email protected]>
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
namespace FOS\ElasticaBundle\Tests\Functional;
use Elastica\Query\Match;
* @group functional
class PropertyPathTest extends WebTestCase
{
public function testContainerSource()
static::bootKernel(['test_case' => 'ORM']);
/** @var \FOS\ElasticaBundle\Persister\ObjectPersister $persister */
$persister = static::$kernel->getContainer()->get('fos_elastica.object_persister.index.property_paths_type');
$obj = new TypeObj();
$obj->coll = 'Hello';
$persister->insertOne($obj);
/** @var \Elastica\Index $index */
$index = static::$kernel->getContainer()->get('fos_elastica.index.index');
$index->refresh();
$query = new Match();
$query->setField('something', 'Hello');
$search = $index->createSearch($query);
$query
object<Elastica\Query\Match>
string|array|object<Elastica\Query>
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example:
function acceptsInteger($int) { } $x = '123'; // string "123" // Instead of acceptsInteger($x); // we recommend to use acceptsInteger((integer) $x);
$this->assertSame(1, $search->count());
}
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: