本文整理汇总了PHP中Book::setTitle方法的典型用法代码示例。如果您正苦于以下问题:PHP Book::setTitle方法的具体用法?PHP Book::setTitle怎么用?PHP Book::setTitle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Book
的用法示例。
在下文中一共展示了Book::setTitle方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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();
}
示例2: handlePUT
function handlePUT(mysqli $conn)
{
parse_str(file_get_contents("php://input"), $data);
$book = new Book();
$book->update($conn, $data['id']);
$book->setTitle($data['title']);
$book->setAuthor($data['author']);
$book->setDesc($data['desc']);
}
示例3: bookInsertion
function bookInsertion($title, $ISBN, $author)
{
$book = new \Book();
$book->setTitle($title);
$book->setISBN($ISBN);
$book->setAuthor($author);
$book->save();
return $book;
}
示例4: testAddingABook
public function testAddingABook()
{
$author = AuthorPeer::retrieveByPK($this->author->getId());
$c1 = new Book();
$c1->setTitle("ORM 101");
$author->addBook($c1);
$this->assertEquals(3, count($author->getBooks()));
$this->assertEquals(3, $author->countBooks());
}
示例5: testUpdate
function testUpdate()
{
$book_name = "Siddhartha";
$test_book = new Book($book_name);
$test_book->save();
$test_book->setTitle("Peace Train");
$test_book->update();
$result = Book::getAll();
$this->assertEquals($test_book, $result[0]);
}
示例6: runBookInsertion
function runBookInsertion($i)
{
$book = new Book();
$book->setTitle('Hello' . $i);
$book->setAuthorId($this->authors[array_rand($this->authors)]);
$book->setISBN('1234');
$book->setPrice($i);
$book->save($this->con);
$this->books[] = $book->getId();
}
示例7: testSetTitle
function testSetTitle()
{
//Arrange
$title = "Grapes of Wrath";
$test_book = new Book($title);
//Act
$test_book->setTitle("Cannary Row");
$result = $test_book->getTitle();
//Assert
$this->assertEquals("Cannary Row", $result);
}
示例8: Book
function test_setTitle()
{
//Arrange
$title = "Uncle Ben's puzzle basement";
$id = 1;
$test_book = new Book($title, $id);
//Act
$test_book->setTitle("Welcome to Puzzle Heaven");
$result = $test_book->getTitle();
//Assert
$this->assertEquals($result, "Welcome to Puzzle Heaven");
}
示例9: Book
function test_setTitle()
{
//Arrange
$title = "Ben";
$id = null;
$test_book = new Book($title, $id);
//Act
$test_book->setTitle("Jeremy");
$result = $test_book->getTitle();
//Assert
$this->assertEquals("Jeremy", $result);
}
示例10: testSetTitle
function testSetTitle()
{
//Arrange
$title = "Little Cat";
$id = 1;
$test_book = new Book($title, $id);
//Act
$test_book->setTitle("Big Cat");
$result = $test_book->getTitle();
//Assert
$this->assertEquals("Big Cat", $result);
}
示例11: createBooks
protected function createBooks($nb = 15, $con = null)
{
BookQuery::create()->deleteAll($con);
$books = new PropelObjectCollection();
$books->setModel('Book');
for ($i = 0; $i < $nb; $i++) {
$b = new Book();
$b->setTitle('Book' . $i);
$books[] = $b;
}
$books->save($con);
}
示例12: Book
function test_setTitle()
{
//Arrange
$title = "Adventures on Mars";
$test_book = new Book($title);
//Act
$title2 = "Adventures on Mars 2 Adventure Harder";
$test_book->setTitle($title2);
$result = $test_book->getTitle();
//Assert
$this->assertEquals($title2, $result);
}
示例13: setUp
protected function setUp()
{
// reset db contents
\BookQuery::create()->deleteAll();
\BookI18nQuery::create()->deleteAll();
// fill in some dummy data
// lord of the rings
$b = new \Book();
$b->setTitle('Lord of the Rings');
$b->setTitle('Herr der Ringe', 'de');
$b->setTitle('Yubiwa Monogatari', 'ja-latn-JP');
$b->save();
// harry potter
$b = new \Book();
$b->setTitle('Harry Potter and the Philosopher\'s Stone');
$b->setTitle('Harry Potter und der Stein der Weisen', 'de');
$b->setTitle('Harī Pottā to kenja no ishi', 'ja-latn-JP');
$b->save();
$b = new \Book();
$b->setTitle('Harry Potter and the Prisoner of Azkaban');
$b->setTitle('Harry Potter und der Gefangene von Askaban', 'de');
$b->setTitle('Harī Pottā to Azukaban no shūjin', 'ja-latn-JP');
$b->save();
}
示例14: runBookInsertion
function runBookInsertion($i)
{
$rand = array_rand($this->authors);
$book = new Book();
$book->setTitle('Hello' . $i);
$book->setAuthor($this->authors[$rand]);
$book->setISBN('1234');
$book->setPrice($i);
$this->session->persist($book);
$this->session->persist($this->authors[$rand]);
$this->books[] = $book;
$this->i++;
if ($this->i >= 500) {
$this->commit();
$this->beginTransaction();
}
}
示例15: setUp
protected function setUp()
{
parent::setUp();
BookstoreDataPopulator::populate();
$cr = new Criteria();
$cr->add(AuthorPeer::LAST_NAME, "Rowling");
$cr->add(AuthorPeer::FIRST_NAME, "J.K.");
$rowling = AuthorPeer::doSelectOne($cr);
$this->authorId = $rowling->getId();
$book = new Book();
$book->setTitle("Harry Potter and the Philosopher's Stone");
$book->setISBN("1234");
$book->setAuthor($rowling);
$book->save();
$this->books[] = $book->getId();
$book = new Book();
$book->setTitle("Harry Potter and the Chamber of Secrets");
$book->setISBN("1234");
$book->setAuthor($rowling);
$book->save();
$this->books[] = $book->getId();
$book = new Book();
$book->setTitle("Harry Potter and the Prisoner of Azkaban");
$book->setISBN("1234");
$book->setAuthor($rowling);
$book->save();
$this->books[] = $book->getId();
$book = new Book();
$book->setTitle("Harry Potter and the Goblet of Fire");
$book->setISBN("1234");
$book->setAuthor($rowling);
$book->save();
$this->books[] = $book->getId();
$book = new Book();
$book->setTitle("Harry Potter and the Half-Blood Prince");
$book->setISBN("1234");
$book->setAuthor($rowling);
$book->save();
$this->books[] = $book->getId();
$book = new Book();
$book->setTitle("Harry Potter and the Deathly Hallows");
$book->setISBN("1234");
$book->setAuthor($rowling);
$book->save();
$this->books[] = $book->getId();
}