Skip to content

Commit

Permalink
More fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
terabytesoftw committed Oct 17, 2023
1 parent 699a09c commit 428b5f0
Show file tree
Hide file tree
Showing 12 changed files with 145 additions and 161 deletions.
2 changes: 1 addition & 1 deletion tests/ActiveDataProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ protected function setUp(): void
$item->save(false);
}

public function testQuery()
public function testQuery(): void
{
$query = Item::find();
$provider = new ActiveDataProvider(['query' => $query]);
Expand Down
52 changes: 26 additions & 26 deletions tests/ActiveRecordTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,13 @@ public function setUp(): void
$item->save(false);

$order = new Order();
$order->setAttributes(['customer_id' => 1, 'created_at' => 1325282384, 'total' => 110.0], false);
$order->setAttributes(['customer_id' => 1, 'created_at' => 1_325_282_384, 'total' => 110.0], false);
$order->save(false);
$order = new Order();
$order->setAttributes(['customer_id' => 2, 'created_at' => 1325334482, 'total' => 33.0], false);
$order->setAttributes(['customer_id' => 2, 'created_at' => 1_325_334_482, 'total' => 33.0], false);
$order->save(false);
$order = new Order();
$order->setAttributes(['customer_id' => 2, 'created_at' => 1325502201, 'total' => 40.0], false);
$order->setAttributes(['customer_id' => 2, 'created_at' => 1_325_502_201, 'total' => 40.0], false);
$order->save(false);

$orderItem = new OrderItem();
Expand All @@ -138,13 +138,13 @@ public function setUp(): void
$orderItem->save(false);

$order = new OrderWithNullFK();
$order->setAttributes(['customer_id' => 1, 'created_at' => 1325282384, 'total' => 110.0], false);
$order->setAttributes(['customer_id' => 1, 'created_at' => 1_325_282_384, 'total' => 110.0], false);
$order->save(false);
$order = new OrderWithNullFK();
$order->setAttributes(['customer_id' => 2, 'created_at' => 1325334482, 'total' => 33.0], false);
$order->setAttributes(['customer_id' => 2, 'created_at' => 1_325_334_482, 'total' => 33.0], false);
$order->save(false);
$order = new OrderWithNullFK();
$order->setAttributes(['customer_id' => 2, 'created_at' => 1325502201, 'total' => 40.0], false);
$order->setAttributes(['customer_id' => 2, 'created_at' => 1_325_502_201, 'total' => 40.0], false);
$order->save(false);

$orderItem = new OrderItemWithNullFK();
Expand All @@ -170,7 +170,7 @@ public function setUp(): void
/**
* overridden because null values are not part of the asArray result in redis
*/
public function testFindAsArray()
public function testFindAsArray(): void
{
/* @var $customerClass \yii\db\ActiveRecordInterface */
$customerClass = $this->getCustomerClass();
Expand Down Expand Up @@ -205,7 +205,7 @@ public function testFindAsArray()
$this->assertArrayHasKey('status', $customers[2]);
}

public function testStatisticalFind()
public function testStatisticalFind(): void
{
// find count, sum, average, min, max, scalar
$this->assertEquals(3, Customer::find()->count());
Expand All @@ -220,7 +220,7 @@ public function testStatisticalFind()

// TODO test serial column incr

public function testUpdatePk()
public function testUpdatePk(): void
{
// updateCounters
$pk = ['order_id' => 2, 'item_id' => 4];
Expand All @@ -237,7 +237,7 @@ public function testUpdatePk()
$this->assertNotNull(OrderItem::findOne(['order_id' => 2, 'item_id' => 10]));
}

public function testFilterWhere()
public function testFilterWhere(): void
{
// should work with hash format
$query = new ActiveQuery('dummy');
Expand Down Expand Up @@ -300,14 +300,14 @@ public function testFilterWhere()
$this->assertEquals($condition, $query->where);
}

public function testFilterWhereRecursively()
public function testFilterWhereRecursively(): void
{
$query = new ActiveQuery('dummy');
$query->filterWhere(['and', ['like', 'name', ''], ['like', 'title', ''], ['id' => 1], ['not', ['like', 'name', '']]]);
$this->assertEquals(['and', ['id' => 1]], $query->where);
}

public function testAutoIncrement()
public function testAutoIncrement(): void
{
Customer::getDb()->executeCommand('FLUSHDB');

Expand Down Expand Up @@ -348,7 +348,7 @@ public function testAutoIncrement()
$this->assertEquals('user6', $customer->name);
}

public function testEscapeData()
public function testEscapeData(): void
{
$customer = new Customer();
$customer->email = "the People's Republic of China";
Expand All @@ -359,7 +359,7 @@ public function testEscapeData()
$this->assertSame("the People's Republic of China", $c->email);
}

public function testFindEmptyWith()
public function testFindEmptyWith(): void
{
Order::getDb()->flushdb();
$orders = Order::find()
Expand All @@ -370,7 +370,7 @@ public function testFindEmptyWith()
$this->assertEquals([], $orders);
}

public function testEmulateExecution()
public function testEmulateExecution(): void
{
$rows = Order::find()
->emulateExecution()
Expand Down Expand Up @@ -426,13 +426,13 @@ public function testEmulateExecution()
/**
* @see https://github.com/yiisoft/yii2-redis/issues/93
*/
public function testDeleteAllWithCondition()
public function testDeleteAllWithCondition(): void
{
$deletedCount = Order::deleteAll(['in', 'id', [1, 2, 3]]);
$this->assertEquals(3, $deletedCount);
}

public function testBuildKey()
public function testBuildKey(): void
{
$pk = ['order_id' => 3, 'item_id' => 'nostr'];
$key = OrderItem::buildKey($pk);
Expand All @@ -444,7 +444,7 @@ public function testBuildKey()
$this->assertEquals($key, OrderItem::buildKey($pk));
}

public function testNotCondition()
public function testNotCondition(): void
{
/* @var $orderClass \yii\db\ActiveRecordInterface */
$orderClass = $this->getOrderClass();
Expand All @@ -455,7 +455,7 @@ public function testNotCondition()
$this->assertEquals(1, $orders[0]['customer_id']);
}

public function testBetweenCondition()
public function testBetweenCondition(): void
{
/* @var $orderClass \yii\db\ActiveRecordInterface */
$orderClass = $this->getOrderClass();
Expand All @@ -471,7 +471,7 @@ public function testBetweenCondition()
$this->assertEquals(1, $orders[0]['customer_id']);
}

public function testInCondition()
public function testInCondition(): void
{
/* @var $orderClass \yii\db\ActiveRecordInterface */
$orderClass = $this->getOrderClass();
Expand All @@ -493,7 +493,7 @@ public function testInCondition()
$this->assertEquals(2, $orders[1]['customer_id']);
}

public function testCountQuery()
public function testCountQuery(): void
{
/* @var $itemClass \yii\db\ActiveRecordInterface */
$itemClass = $this->getItemClass();
Expand All @@ -512,7 +512,7 @@ public function testCountQuery()
/**
* @dataProvider \yiiunit\extensions\redis\providers\Data::illegalValuesForWhere
*/
public function testValueEscapingInWhere($filterWithInjection, $expectedStrings, $unexpectedStrings = [])
public function testValueEscapingInWhere($filterWithInjection, $expectedStrings, $unexpectedStrings = []): void
{
/* @var $itemClass \yii\db\ActiveRecordInterface */
$itemClass = $this->getItemClass();
Expand All @@ -532,7 +532,7 @@ public function testValueEscapingInWhere($filterWithInjection, $expectedStrings,
/**
* @dataProvider \yiiunit\extensions\redis\providers\Data::illegalValuesForFindByCondition
*/
public function testValueEscapingInFindByCondition($filterWithInjection, $expectedStrings, $unexpectedStrings = [])
public function testValueEscapingInFindByCondition($filterWithInjection, $expectedStrings, $unexpectedStrings = []): void
{
/* @var $itemClass \yii\db\ActiveRecordInterface */
$itemClass = $this->getItemClass();
Expand All @@ -552,7 +552,7 @@ public function testValueEscapingInFindByCondition($filterWithInjection, $expect
$this->assertGreaterThan(3, $itemClass::find()->count());
}

public function testCompareCondition()
public function testCompareCondition(): void
{
/* @var $orderClass \yii\db\ActiveRecordInterface */
$orderClass = $this->getOrderClass();
Expand Down Expand Up @@ -580,7 +580,7 @@ public function testCompareCondition()
$this->assertEquals(2, $orders[1]['customer_id']);
}

public function testStringCompareCondition()
public function testStringCompareCondition(): void
{
/* @var $itemClass \yii\db\ActiveRecordInterface */
$itemClass = $this->getItemClass();
Expand All @@ -603,7 +603,7 @@ public function testStringCompareCondition()
$this->assertCount(2, $items);
}

public function testFind()
public function testFind(): void
{
/* @var $customerClass \yii\db\ActiveRecordInterface */
$customerClass = $this->getCustomerClass();
Expand Down
Loading

0 comments on commit 428b5f0

Please sign in to comment.