/** * @depends testGetValue **/ public function testValueDataProvider() { $model = new RedisItem(); $model->setAttributes(['key' => 'testfxt:3:hash', 'type' => 'hash', 'value' => ['hashfield1' => 'hashval1', 'hashfield2' => 'hashval2']]); $dp = $model->valueDataProvider(); $this->assertInstanceOf('\\yii\\data\\ArrayDataProvider', $dp); $this->assertTrue($dp->getCount() == 2); $this->assertTrue($dp->getTotalCount() == 2); $model = new RedisItem(); $model->setAttributes(['key' => 'testfxt:3:zset', 'type' => 'hash', 'value' => ['someval2' => 3, 'someval1' => 4, 'someval3' => 8]]); $dp = $model->valueDataProvider(); $this->assertInstanceOf('\\yii\\data\\ArrayDataProvider', $dp); $this->assertTrue($dp->getCount() == 3); $this->assertTrue($dp->getTotalCount() == 3); }