Beispiel #1
0
 /**
  * Tests Collection::findById
  *
  * @author Serghei Iakovlev <*****@*****.**>
  * @since  2016-07-24
  * @issue  12010
  */
 public function testShouldUseCorrectMongoId()
 {
     $this->specify('The Collection::findById does not return expected result', function () {
         $song = new Songs();
         $song->artist = 'Jo Blankenburg';
         $song->name = 'Valkyrie';
         $song->create();
         $mongoIdObject = $song->_id;
         expect(Songs::findById($mongoIdObject->__toString()))->isInstanceOf('\\Phalcon\\Mvc\\CollectionInterface');
         expect(Songs::findById($mongoIdObject))->isInstanceOf('\\Phalcon\\Mvc\\CollectionInterface');
         expect(Songs::findById('qwerty-1234'))->null();
         expect(Songs::findById('s'))->null();
         expect(Songs::findById(str_repeat('0', 25)))->null();
         expect(Songs::findById(''))->null();
         expect(Songs::findById(null))->null();
         expect(Songs::findById(false))->null();
     });
 }