forked from phalcon/cphalcon
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request phalcon#11983 from rudiservo/Issue-10800
Proposed Fix for Issue phalcon#10800
- Loading branch information
Showing
2 changed files
with
61 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<?php | ||
|
||
namespace Phalcon\Test\Unit\Mvc; | ||
|
||
use Phalcon\Mvc\Model\Criteria; | ||
use Phalcon\Test\Models\AlbumORama\Albums; | ||
use Phalcon\Test\Module\UnitTest; | ||
|
||
/** | ||
* \Phalcon\Test\Unit\Mvc\Model\ManagerTest | ||
* Tests the Phalcon\Mvc\Model\Manager component | ||
* | ||
* @copyright (c) 2011-2016 Phalcon Team | ||
* @link http://www.phalconphp.com | ||
* @author Andres Gutierrez <andres@phalconphp.com> | ||
* @author Serghei Iakovlev <serghei@phalconphp.com> | ||
* @author Wojciech Ślawski <jurigag@gmail.com> | ||
* @package Phalcon\Test\Unit\Mvc\Model | ||
* | ||
* The contents of this file are subject to the New BSD License that is | ||
* bundled with this package in the file docs/LICENSE.txt | ||
* | ||
* If you did not receive a copy of the license and are unable to obtain it | ||
* through the world-wide-web, please send an email to license@phalconphp.com | ||
* so that we can send you a copy immediately. | ||
*/ | ||
class ModelTest extends UnitTest | ||
{ | ||
/** | ||
* @var Manager | ||
*/ | ||
private $modelsManager; | ||
|
||
|
||
protected function _before() | ||
{ | ||
parent::_before(); | ||
/** @var \Phalcon\Mvc\Application $app */ | ||
$app = $this->tester->getApplication(); | ||
$this->modelsManager = $app->getDI()->getShared('modelsManager'); | ||
} | ||
|
||
public function testCamelCaseRelation() | ||
{ | ||
$this->specify( | ||
"CamelCase relation calls should be the same cache", | ||
function () { | ||
$this->modelsManager->registerNamespaceAlias('AlbumORama','Phalcon\Test\Models\AlbumORama'); | ||
$album = Albums::findFirst(); | ||
$album->artist->name = 'NotArtist'; | ||
expect($album->artist->name)->equals($album->Artist->name); | ||
} | ||
); | ||
} | ||
} |