当前位置: 首页>>代码示例>>PHP>>正文


PHP Book::getTitle方法代码示例

本文整理汇总了PHP中Book::getTitle方法的典型用法代码示例。如果您正苦于以下问题:PHP Book::getTitle方法的具体用法?PHP Book::getTitle怎么用?PHP Book::getTitle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Book的用法示例。


在下文中一共展示了Book::getTitle方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testGetBookName

 function testGetBookName()
 {
     $book_name = "Siddhartha";
     $test_book = new Book($book_name);
     $result = $test_book->getTitle();
     $this->assertEquals($book_name, $result);
 }
开发者ID:JordanNavratil,项目名称:Library,代码行数:7,代码来源:BookTest.php

示例2: testFormatALotOfResults

 public function testFormatALotOfResults()
 {
     $nbBooks = 50;
     $con = Propel::getConnection(BookPeer::DATABASE_NAME);
     Propel::disableInstancePooling();
     $book = new Book();
     for ($i = 0; $i < $nbBooks; $i++) {
         $book->clear();
         $book->setTitle('BookTest' . $i);
         $book->save($con);
     }
     $stmt = $con->query('SELECT * FROM book');
     $formatter = new PropelOnDemandFormatter();
     $formatter->init(new ModelCriteria('bookstore', 'Book'));
     $books = $formatter->format($stmt);
     $this->assertTrue($books instanceof PropelOnDemandCollection, 'PropelOnDemandFormatter::format() returns a PropelOnDemandCollection');
     $this->assertEquals($nbBooks, count($books), 'PropelOnDemandFormatter::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, 'PropelOnDemandFormatter::format() returns a collection of Model objects');
         $this->assertEquals('BookTest' . $i, $book->getTitle(), 'PropelOnDemandFormatter::format() returns the model objects matching the query');
         $i++;
     }
     Propel::enableInstancePooling();
 }
开发者ID:kcornejo,项目名称:estadistica,代码行数:25,代码来源:PropelOnDemandFormatterTest.php

示例3: testWeCanCreateABookWithInformation

 public function testWeCanCreateABookWithInformation()
 {
     $title = 'New Title';
     $author = "Author";
     $book = new Book($title, $author);
     $this->assertEquals($title, $book->getTitle());
     $this->assertEquals($author, $book->getAuthor());
 }
开发者ID:Witoso,项目名称:learningphp,代码行数:8,代码来源:BookTest.php

示例4: Book

 function test_getTitle()
 {
     $title = "Three Blind Mice";
     $id = 1;
     $test_book = new Book($title, $id);
     $result = $test_book->getTitle();
     $this->assertEquals($title, $result);
 }
开发者ID:juliocesardiaz,项目名称:Library,代码行数:8,代码来源:BookTest.php

示例5: testUpdate

 function testUpdate()
 {
     $title = "Anathem";
     $test_book = new Book($title);
     $test_book->save();
     $new_title = "crypotnomicon";
     $test_book->update($new_title);
     $this->assertEquals($new_title, $test_book->getTitle());
 }
开发者ID:umamiMike,项目名称:library-1,代码行数:9,代码来源:BookTest.php

示例6: Book

 function test_getTitle()
 {
     //Arrange
     $title = "America";
     $test_book = new Book($title);
     //Act
     $result = $test_book->getTitle();
     //Assert
     $this->assertEquals($title, $result);
 }
开发者ID:r-hills,项目名称:Library,代码行数:10,代码来源:BookTest.php

示例7: Book

 function test_getTitle()
 {
     //Arrange
     $title = "Whimsical Fairytales...and other stories";
     $genre = "Fantasy";
     $test_book = new Book($title, $genre);
     //Act
     $result = $test_book->getTitle();
     //Assert
     $this->assertEquals($title, $result);
 }
开发者ID:r-hills,项目名称:library-1,代码行数:11,代码来源:BookTest.php

示例8: testUtf8

 public function testUtf8()
 {
     $db = Propel::getDB(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:dracony,项目名称:forked-php-orm-benchmark,代码行数:21,代码来源:CharacterEncodingTest.php

示例9: testUpdate

 function testUpdate()
 {
     //Arrange
     $title = "Little Cat";
     $id = 1;
     $test_book = new Book($title, $id);
     $test_book->save();
     $new_title = "Big Cat";
     //Act
     $test_book->update($new_title);
     //Assert
     $this->assertEquals("Big Cat", $test_book->getTitle());
 }
开发者ID:bborealis,项目名称:library-1,代码行数:13,代码来源:BookTest.php

示例10: __autoload

<?php

ini_set('display_errors', '1');
function __autoload($class_name)
{
    set_include_path('class');
    include_once $class_name . '.php';
}
// client
writeln('BEGIN TESTING FACADE PATTERN');
writeln('');
$book = new Book('Design Patterns', 'Gamma, Helm, Johnson, and Vlissides');
writeln('Original book title: ' . $book->getTitle());
writeln('');
$bookTitleReversed = CaseReverseFacade::reverseStringCase($book->getTitle());
writeln('Reversed book title: ' . $bookTitleReversed);
writeln('');
writeln('END TESTING FACADE PATTERN');
function writeln($line_in)
{
    echo $line_in . "<br/>";
}
开发者ID:valerij-usachov,项目名称:SandBox,代码行数:22,代码来源:index.php

示例11: getAuthors

    }
    public function getAuthors()
    {
        return $this->related(new Author());
    }
}
class Author extends RedBean_DomainObject
{
    public function setName($name)
    {
        $this->bean->name = $name;
    }
    public function getName()
    {
        return $this->bean->name;
    }
}
$book = new Book();
$author = new Author();
$book->setTitle("A can of beans");
$author->setName("Mr. Bean");
$book->addAuthor($author);
$id = $book->getID();
$book2 = new Book();
$book2->find($id);
asrt($book2->getTitle(), "A can of beans");
$authors = $book2->getAuthors();
asrt(count($authors), 1);
$he = array_pop($authors);
asrt($he->getName(), "Mr. Bean");
printtext("\nALL TESTS PASSED. REDBEAN SHOULD WORK FINE.\n");
开发者ID:surfnjunkie,项目名称:redbean,代码行数:31,代码来源:test.php

示例12: max

 function add_to_shelf()
 {
     global $current_user;
     /*@var $current_user CurrentUser*/
     $this->ca();
     $bookId = max(0, (int) $_POST['id']);
     $shelf = max(0, (int) $_POST['shelf_id']);
     $this->data['shelf_id'] = $shelf;
     $this->data['id'] = $bookId;
     if ($bookId && $shelf) {
         if ($current_user->authorized) {
             $book = new Book($bookId);
             if ($book->getTitle()) {
                 $this->data['title'] = trim(implode(' ', $book->getTitle()));
                 $current_user->AddBookShelf($book->id, $shelf);
                 $this->data['success'] = 1;
                 $current_user->reloadPolkaCounters();
                 $current_user->save();
             }
         }
     }
 }
开发者ID:rasstroen,项目名称:metro,代码行数:22,代码来源:Jbooks_module.php

示例13: Book

 function test_updateTitle()
 {
     //Arrange
     $title = "Revenge of the Martians";
     $test_book = new Book($title);
     $test_book->save();
     $title2 = "Star Wars";
     $test_book2 = new Book($title2);
     $test_book2->save();
     //Act
     $test_book2->updateTitle($title);
     $result = Book::find($test_book2->getId());
     //Assert
     $this->assertEquals($test_book->getTitle(), $result->getTitle());
 }
开发者ID:kevintokheim,项目名称:Liberry,代码行数:15,代码来源:BookTest.php

示例14: Course

foreach ($courses as $c) {
    echo $c->getDescription() . "\n";
}
$c = new Course();
$c->setId(1);
$c->load();
echo $c->getDescription() . "\n";
$students = $c->getStudents();
foreach ($students as $s) {
    echo $s->getName() . "\n";
}
//SEARCH
$p = new Person();
$p->setName('Mat');
$search = $p->search();
$search->orderBy('name');
$list = $search->execute();
foreach ($list as $p) {
    echo $p->getName() . "\n";
}
//Recursive Search
$c = new City();
$c->setName('San');
$p = new Person();
$p->setCity($c);
$b = new Book();
$b->setAuthor($p);
$list = $b->search()->execute();
foreach ($list as $b) {
    echo $b->getTitle() . "\n";
}
开发者ID:mateusfornari,项目名称:hypersistence-alpha,代码行数:31,代码来源:index.php

示例15: testUpdateTitle

 function testUpdateTitle()
 {
     $title = "The Life and Times of Carrot Top";
     $id = 1;
     $test_book = new Book($title, $id);
     $test_book->save();
     $new_title = "The Old Man Had to Pee";
     $test_book->updateTitle($new_title);
     $this->assertEquals("The Old Man Had to Pee", $test_book->getTitle());
 }
开发者ID:bdspen,项目名称:library_day1,代码行数:10,代码来源:BookTest.php


注:本文中的Book::getTitle方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。