当前位置: 首页>>代码示例>>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;未经允许,请勿转载。