Commit 7e961eee by Carsten Brandt

fixed test break

parent 829850da
...@@ -41,4 +41,10 @@ class Exception extends \yii\base\Exception ...@@ -41,4 +41,10 @@ class Exception extends \yii\base\Exception
{ {
return 'Database Exception'; return 'Database Exception';
} }
public function __toString()
{
return parent::__toString() . PHP_EOL
. 'Additional Information:' . PHP_EOL . print_r($this->errorInfo, true);
}
} }
...@@ -58,7 +58,6 @@ class Customer extends ActiveRecord ...@@ -58,7 +58,6 @@ class Customer extends ActiveRecord
static::type() => [ static::type() => [
"_id" => ["path" => "id", "index" => "not_analyzed", "store" => "yes"], "_id" => ["path" => "id", "index" => "not_analyzed", "store" => "yes"],
"properties" => [ "properties" => [
"id" => ["type" => "integer"],
"name" => ["type" => "string", "index" => "not_analyzed"], "name" => ["type" => "string", "index" => "not_analyzed"],
"email" => ["type" => "string", "index" => "not_analyzed"], "email" => ["type" => "string", "index" => "not_analyzed"],
"address" => ["type" => "string", "index" => "analyzed"], "address" => ["type" => "string", "index" => "analyzed"],
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
namespace yiiunit\extensions\elasticsearch; namespace yiiunit\extensions\elasticsearch;
use yii\base\Event; use yii\base\Event;
use yii\base\Exception;
use yii\db\BaseActiveRecord; use yii\db\BaseActiveRecord;
use yii\elasticsearch\Connection; use yii\elasticsearch\Connection;
use yii\helpers\Json; use yii\helpers\Json;
...@@ -344,8 +345,8 @@ class ActiveRecordTest extends ElasticSearchTestCase ...@@ -344,8 +345,8 @@ class ActiveRecordTest extends ElasticSearchTestCase
public function testBooleanAttribute() public function testBooleanAttribute()
{ {
$db = $this->getConnection(); $db = $this->getConnection();
Customer::setUpMapping($db->createCommand(), true);
Customer::deleteAll(); Customer::deleteAll();
Customer::setUpMapping($db->createCommand(), true);
$customerClass = $this->getCustomerClass(); $customerClass = $this->getCustomerClass();
$customer = new $customerClass(); $customer = new $customerClass();
...@@ -378,7 +379,7 @@ class ActiveRecordTest extends ElasticSearchTestCase ...@@ -378,7 +379,7 @@ class ActiveRecordTest extends ElasticSearchTestCase
$this->assertEquals(2, count($customers)); $this->assertEquals(2, count($customers));
} }
public function testfindAsArrayFields() public function testFindAsArrayFields()
{ {
$customerClass = $this->getCustomerClass(); $customerClass = $this->getCustomerClass();
/** @var TestCase|ActiveRecordTestTrait $this */ /** @var TestCase|ActiveRecordTestTrait $this */
...@@ -402,7 +403,7 @@ class ActiveRecordTest extends ElasticSearchTestCase ...@@ -402,7 +403,7 @@ class ActiveRecordTest extends ElasticSearchTestCase
$this->assertArrayNotHasKey('status', $customers[2]); $this->assertArrayNotHasKey('status', $customers[2]);
} }
public function testfindIndexByFields() public function testFindIndexByFields()
{ {
$customerClass = $this->getCustomerClass(); $customerClass = $this->getCustomerClass();
/** @var TestCase|ActiveRecordTestTrait $this */ /** @var TestCase|ActiveRecordTestTrait $this */
...@@ -453,7 +454,7 @@ class ActiveRecordTest extends ElasticSearchTestCase ...@@ -453,7 +454,7 @@ class ActiveRecordTest extends ElasticSearchTestCase
$this->assertNull($customers['3-user3']->status); $this->assertNull($customers['3-user3']->status);
} }
public function testfindIndexByAsArrayFields() public function testFindIndexByAsArrayFields()
{ {
$customerClass = $this->getCustomerClass(); $customerClass = $this->getCustomerClass();
/** @var TestCase|ActiveRecordTestTrait $this */ /** @var TestCase|ActiveRecordTestTrait $this */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment