當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Book::getTitle方法代碼示例

本文整理匯總了PHP中Propel\Tests\Bookstore\Book::getTitle方法的典型用法代碼示例。如果您正苦於以下問題:PHP Book::getTitle方法的具體用法?PHP Book::getTitle怎麽用?PHP Book::getTitle使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Propel\Tests\Bookstore\Book的用法示例。


在下文中一共展示了Book::getTitle方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testUtf8

 public function testUtf8()
 {
     $this->markTestSkipped('Skipped because of weird behavior on some platforms');
     $db = Propel::getServiceContainer()->getAdapter(BookPeer::DATABASE_NAME);
     $title = "Смерть на брудершафт. Младенец и черт";
     //        1234567890123456789012345678901234567
     //                 1         2         3
     $a = new Author();
     $a->setFirstName("Б.");
     $a->setLastName("АКУНИН");
     $p = new Publisher();
     $p->setName("Детектив российский, остросюжетная проза");
     $b = new Book();
     $b->setTitle($title);
     $b->setISBN("B-59246");
     $b->setAuthor($a);
     $b->setPublisher($p);
     $b->save();
     $b->reload();
     $this->assertEquals(37, iconv_strlen($b->getTitle(), 'utf-8'), "Expected 37 characters (not bytes) in title.");
     $this->assertTrue(strlen($b->getTitle()) > iconv_strlen($b->getTitle(), 'utf-8'), "Expected more bytes than characters in title.");
 }
開發者ID:norfil,項目名稱:Propel2,代碼行數:22,代碼來源:CharacterEncodingTest.php

示例2: testSetByName

 /**
  * Tests the Base[Object]::setByName() method
  */
 public function testSetByName()
 {
     $book = new Book();
     $types = array(BasePeer::TYPE_PHPNAME => 'Title', BasePeer::TYPE_STUDLYPHPNAME => 'title', BasePeer::TYPE_COLNAME => 'book.TITLE', BasePeer::TYPE_FIELDNAME => 'title', BasePeer::TYPE_NUM => 1);
     $title = 'Harry Potter and the Order of the Phoenix';
     foreach ($types as $type => $name) {
         $book->setByName($name, $title, $type);
         $result = $book->getTitle();
         $this->assertEquals($title, $result);
     }
 }
開發者ID:norfil,項目名稱:Propel2,代碼行數:14,代碼來源:FieldnameRelatedTest.php

示例3: testFormatALotOfResults

 public function testFormatALotOfResults()
 {
     $nbBooks = 50;
     $con = Propel::getServiceContainer()->getConnection(BookTableMap::DATABASE_NAME);
     Propel::disableInstancePooling();
     $book = new Book();
     for ($i = 0; $i < $nbBooks; $i++) {
         $book->clear();
         $book->setTitle('BookTest' . $i);
         $book->setISBN('FA404-' . $i);
         $book->save($con);
     }
     $stmt = $con->query('SELECT * FROM book');
     $formatter = new OnDemandFormatter();
     $formatter->init(new ModelCriteria('bookstore', 'Propel\\Tests\\Bookstore\\Book'));
     $books = $formatter->format($stmt);
     $this->assertTrue($books instanceof OnDemandCollection, 'OnDemandFormatter::format() returns a PropelOnDemandCollection');
     $this->assertEquals($nbBooks, count($books), 'OnDemandFormatter::format() returns a collection that counts as many rows as the results in the query');
     $i = 0;
     foreach ($books as $book) {
         $this->assertTrue($book instanceof Book, 'OnDemandFormatter::format() returns a collection of Model objects');
         $this->assertEquals('BookTest' . $i, $book->getTitle(), 'OnDemandFormatter::format() returns the model objects matching the query');
         $i++;
     }
     Propel::enableInstancePooling();
 }
開發者ID:robin850,項目名稱:Propel2,代碼行數:26,代碼來源:OnDemandFormatterTest.php

示例4: testSetByName

 /**
  * Tests the Base[Object]::setByName() method
  */
 public function testSetByName()
 {
     $book = new Book();
     $types = [TableMap::TYPE_PHPNAME => 'Title', TableMap::TYPE_CAMELNAME => 'title', TableMap::TYPE_COLNAME => 'book.title', TableMap::TYPE_FIELDNAME => 'title', TableMap::TYPE_NUM => 1];
     $title = 'Harry Potter and the Order of the Phoenix';
     foreach ($types as $type => $name) {
         $book->setByName($name, $title, $type);
         $result = $book->getTitle();
         $this->assertEquals($title, $result);
     }
 }
開發者ID:disider,項目名稱:Propel2,代碼行數:14,代碼來源:FieldnameRelatedTest.php


注:本文中的Propel\Tests\Bookstore\Book::getTitle方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。