Browse Source

Added 'software' and 'hardware' string to BaseInflector $specials.

tags/2.0.43
Kamchybek Jusupov 3 years ago
parent
commit
9c8f653554
  1. 6
      framework/helpers/BaseInflector.php
  2. 5
      tests/framework/helpers/InflectorTest.php

6
framework/helpers/BaseInflector.php

@ -1,4 +1,5 @@
<?php
/**
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
@ -219,6 +220,10 @@ class BaseInflector
'whiting' => 'whiting',
'wildebeest' => 'wildebeest',
'Yengeese' => 'Yengeese',
'software' => 'software',
'Software' => 'Software',
'hardware' => 'hardware',
'Hardware' => 'Hardware',
];
/**
* @var array fallback map for transliteration used by [[transliterate()]] when intl isn't available.
@ -619,5 +624,4 @@ class BaseInflector
{
return isset(Yii::$app) ? Yii::$app->charset : 'UTF-8';
}
}

5
tests/framework/helpers/InflectorTest.php

@ -1,4 +1,5 @@
<?php
/**
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
@ -44,6 +45,8 @@ class InflectorTest extends TestCase
'car' => 'cars',
'netherlands' => 'netherlands',
'currency' => 'currencies',
'software' => 'software',
'hardware' => 'hardware',
];
foreach ($testData as $testIn => $testOut) {
@ -73,6 +76,8 @@ class InflectorTest extends TestCase
'cars' => 'car',
'Netherlands' => 'Netherlands',
'currencies' => 'currency',
'software' => 'software',
'hardware' => 'hardware',
];
foreach ($testData as $testIn => $testOut) {
$this->assertEquals($testOut, Inflector::singularize($testIn));

Loading…
Cancel
Save