Skip to content

Commit

Permalink
Merge pull request yiisoft#2 from yiisoft/master
Browse files Browse the repository at this point in the history
merge
  • Loading branch information
mdmunir committed May 22, 2014
2 parents 8f8ec23 + bfb39ed commit ff4307b
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ which is the latest stable release of Yii.
[![Code Coverage](https://scrutinizer-ci.com/g/yiisoft/yii2/badges/coverage.png?s=31d80f1036099e9d6a3e4d7738f6b000b3c3d10e)](https://scrutinizer-ci.com/g/yiisoft/yii2/)
[![Dependency Status](https://www.versioneye.com/php/yiisoft:yii2/dev-master/badge.png)](https://www.versioneye.com/php/yiisoft:yii2/dev-master)
[![Scrutinizer Quality Score](https://scrutinizer-ci.com/g/yiisoft/yii2/badges/quality-score.png?s=b1074a1ff6d0b214d54fa5ab7abbb90fc092471d)](https://scrutinizer-ci.com/g/yiisoft/yii2/)
[![Code Climate](https://codeclimate.com/github/yiisoft/yii2.png)](https://codeclimate.com/github/yiisoft/yii2)

DIRECTORY STRUCTURE
-------------------
Expand Down
11 changes: 11 additions & 0 deletions docs/guide/intro-upgrade-from-v1.md
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,17 @@ as arrays, which can significantly reduce the needed CPU time and memory if larg
$customers = Customer::find()->asArray()->all();
```

Another change is that you can't define attribute default values through public properties anymore.
If you need those, you should set them in the init method of your record class.

```php
public function init()
{
parent::init();
$this->status = self::STATUS_NEW;
}
```

There are many other changes and enhancements to Active Record. Please refer to
the [Active Record](db-active-record.md) section for more details.

Expand Down
1 change: 1 addition & 0 deletions framework/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Yii Framework 2 Change Log
- Bug #3436: Fixed the issue that `ServiceLocator` still returns the old component after calling `set()` with a new definition (qiangxue)
- Bug #3458: Fixed the bug that the image rendered by `CaptchaAction` was using a wrong content type (MDMunir, qiangxue)
- Bug #3522: Fixed BaseFileHelper::normalizePath to allow a (.) for the current path. (skotos)
- Bug #3548: Fixed the bug that X-Rate-Limit-Remaining header is always zero when using RateLimiter (qiangxue)
- Bug: Fixed inconsistent return of `\yii\console\Application::runAction()` (samdark)
- Enh #2264: `CookieCollection::has()` will return false for expired or removed cookies (qiangxue)
- Enh #2435: `yii\db\IntegrityException` is now thrown on database integrity errors instead of general `yii\db\Exception` (samdark)
Expand Down
2 changes: 1 addition & 1 deletion framework/filters/RateLimiter.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public function checkRateLimit($user, $request, $response, $action)
throw new TooManyRequestsHttpException($this->errorMessage);
} else {
$user->saveAllowance($request, $action, $allowance - 1, $current);
$this->addRateLimitHeaders($response, $limit, 0, (int) (($limit - $allowance) * $window / $limit));
$this->addRateLimitHeaders($response, $limit, $allowance - 1, (int) (($limit - $allowance) * $window / $limit));
}
}

Expand Down
21 changes: 20 additions & 1 deletion tests/unit/framework/helpers/HtmlTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -293,12 +293,19 @@ public function testListBox()
$expected = <<<EOD
<select name="test" size="4">
<option value="value1&lt;&gt;">text1&lt;&gt;</option>
<option value="value 2">text&nbsp;&nbsp;2</option>
<option value="value 2">text 2</option>
</select>
EOD;
$this->assertEqualsWithoutLE($expected, Html::listBox('test', null, $this->getDataItems2()));
$expected = <<<EOD
<select name="test" size="4">
<option value="value1&lt;&gt;">text1&lt;&gt;</option>
<option value="value 2">text&nbsp;&nbsp;2</option>
</select>
EOD;
$this->assertEqualsWithoutLE($expected, Html::listBox('test', null, $this->getDataItems2(), ['encodeSpaces' => true]));
$expected = <<<EOD
<select name="test" size="4">
<option value="value1">text1</option>
<option value="value2" selected>text2</option>
</select>
Expand Down Expand Up @@ -495,8 +502,20 @@ public function testRenderOptions()
'groups' => [
'group12' => ['class' => 'group'],
],
'encodeSpaces' => true,
];
$this->assertEqualsWithoutLE($expected, Html::renderSelectOptions(['value111', 'value1'], $data, $attributes));

$attributes = [
'prompt' => 'please select<>',
'options' => [
'value111' => ['class' => 'option'],
],
'groups' => [
'group12' => ['class' => 'group'],
],
];
$this->assertEqualsWithoutLE(str_replace('&nbsp;', ' ', $expected), Html::renderSelectOptions(['value111', 'value1'], $data, $attributes));
}

public function testRenderAttributes()
Expand Down

0 comments on commit ff4307b

Please sign in to comment.