Author: Andres Gutierrez (andres@phalconphp.com)
Author: Nikolaos Dimopoulos (nikos@phalconphp.com)
Inheritance: extends Phalcon\Mvc\Model
Esempio n. 1
0
 public function testAliasedNamespacesRelations()
 {
     $this->specify("Aliased namespaces should work in relations", function () {
         $this->modelsManager->registerNamespaceAlias('AlbumORama', 'Phalcon\\Test\\Models\\AlbumORama');
         $albums = Albums::find();
         foreach ($albums as $album) {
             expect($album->artist)->isInstanceOf('Phalcon\\Test\\Models\\AlbumORama\\Artists');
         }
     });
 }
Esempio n. 2
0
 /**
  * Tests find with empty conditions + bind and limit.
  *
  * @issue  11919
  * @author Serghei Iakovlev <*****@*****.**>
  * @since  2016-07-29
  */
 public function testEmptyConditions()
 {
     $this->specify('The Model::find with empty conditions + bind and limit return wrong result', function () {
         $album = Albums::find(['conditions' => '', 'bind' => [], 'limit' => 10]);
         expect($album)->isInstanceOf(Simple::class);
         expect(ini_get('opcache.enable_cli'))->equals(1);
         expect($album->getFirst())->isInstanceOf(Albums::class);
         expect($album->getFirst()->toArray())->equals(['id' => 1, 'artists_id' => 1, 'name' => 'Born to Die']);
     });
 }