本文整理汇总了PHP中Author::getName方法的典型用法代码示例。如果您正苦于以下问题:PHP Author::getName方法的具体用法?PHP Author::getName怎么用?PHP Author::getName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Author
的用法示例。
在下文中一共展示了Author::getName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testUpdate
function testUpdate()
{
$name = "Stephen King";
$test_author = new Author($name);
$test_author->save();
$new_name = "Neal Stephenson";
$test_author->update($new_name);
$this->assertEquals($new_name, $test_author->getName());
}
示例2: Author
function test_getName()
{
//Arrange
$name = "J.K. Rowling";
$test_author = new Author($name);
//Act
$result = $test_author->getName();
//Assert
$this->assertEquals($name, $result);
}
示例3: testSetname
function testSetname()
{
//Arrange
$name = "Mary Shelly";
$test_author = new Author($name);
//Act
$test_author->setName("Dean Koontz");
$result = $test_author->getName();
//Assert
$this->assertEquals("Dean Koontz", $result);
}
示例4: testUpdate
function testUpdate()
{
//Arrange
$name = "JK Rowling";
$id = 1;
$test_author = new Author($name, $id);
$test_author->save();
$new_name = "George RR Martin";
//Act
$test_author->update($new_name);
//Assert
$this->assertEquals("George RR Martin", $test_author->getName());
}
示例5: actionAuhtor
public function actionAuhtor()
{
if ($this->session->isLoging()) {
echo 'Вы уже авторизированны!';
exit;
}
$Author = new Author();
if ($Author->getOneAuthor($this->params['login'], $this->params['pass'])) {
$this->session->set('loging', 'loging');
$this->session->set('author_id', $Author->getAuthorId());
$this->session->set('login', $Author->getLogin());
$this->session->set('pass', $Author->getPass());
$this->session->set('logo', $Author->getLogo());
$this->session->set('name', $Author->getName());
}
$this->view = new View($this->params, PATH_VIEW_MESSAGE, 'welcom_tpl.php', false);
$this->html->add('content', $this->view->render());
$layout = new Layout($this->html->getArray());
$layout->get();
}
示例6: camp_set_author
function camp_set_author(ArticleTypeField $p_sourceField, &$p_errors)
{
$p_errors = array();
$articles = Article::GetArticlesOfType($p_sourceField->getArticleType());
foreach ($articles as $article) {
$articleData = $article->getArticleData();
$authorName = trim($articleData->getFieldValue($p_sourceField->getPrintName()));
if (empty($authorName)) {
continue;
}
$author = new Author($authorName);
if (!$author->exists()) {
if (!$author->create()) {
$p_errors[] = getGS('Unable to create author "$1" for article no. $2 ("$3") of type $4.', $author->getName(), $article->getArticleNumber(), $article->getName(), $article->getType());
continue;
}
}
if (!$article->setAuthorId($author->getId())) {
$p_errors[] = getGS('Error setting the author "$1" for article no. $2 ("$3") of type $4.', $author->getName(), $article->getArticleNumber(), $article->getName(), $article->getType());
continue;
}
}
return count($p_errors);
}
示例7: Author
function test_update()
{
//Arrange
$name = "Steve";
$test_author = new Author($name);
$test_author->save();
//Act
$new_name = "Bob";
$test_author->update($new_name);
$result = $test_author->getName();
//Assert
$this->assertEquals($new_name, $result);
}
示例8: testUpdate
function testUpdate()
{
//Arrange
$name = "Name";
$test_author = new Author($name);
$test_author->save();
$new_name = "New Name";
//Act
$test_author->update($new_name);
//Assert
$this->assertEquals($test_author->getName(), $new_name);
}
示例9: testUpdateObject
public function testUpdateObject()
{
$newAuthor = new Author();
$newAuthor->setName('James Joyce');
$newAuthor->setCreationDatetime(date('Y-m-d H:i:s'));
$newAuthor->save();
$newAuthor->setName('Mark Twain');
$this->assertIdentical($newAuthor->getName(), 'Mark Twain');
$newAuthor->save();
$sameAuthor = Author::constructByKey($newAuthor->getAuthorId());
$this->assertIdentical($sameAuthor->getName(), 'Mark Twain');
}
示例10: testUpdateName
function testUpdateName()
{
//Arrange
$name = "Stephen King";
$id = 1;
$test_author = new Author($name, $id);
$test_author->save();
$new_name = "James Patterson";
//Act
$test_author->updateName($new_name);
//Assert
$this->assertEquals("James Patterson", $test_author->getName());
}
示例11: dirname
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
$app = 'frontend';
$fixtures = 'fixtures/fixtures.yml';
require_once dirname(__FILE__) . '/../bootstrap/functional.php';
$t = new lime_test(22);
$authors = Doctrine_Core::getTable('Author')->findAll();
$t->is(count($authors), 2);
$author = new Author();
// Accessor overriding
$author->setName('Jonathan H. Wage');
$author->save();
// Propel style accessors with column name
$t->is($author->getName(), $author->name);
// Propel style accessors for id
// Also check new author was not created since Jonathan H. Wage exists in fixtures/fixtures.yml
$t->is($author->getId(), 1);
// Make sure we still have only 2 authors
$authors = Doctrine_Core::getTable('Author')->findAll();
$t->is(count($authors), 2);
$article = new Article();
$article->title = 'test';
// __toString() automatic column finder
$t->is((string) $article, 'test');
// Different style accessors
$t->is($article->getAuthor_id(), $article->author_id);
$t->is($article->getAuthorId(), $article->author_id);
$t->is($article->getauthorId(), $article->author_id);
$t->is($article->getAuthorID(), $article->author_id);
示例12: Author
function test_searchAuthor()
{
$name = "Jerry Garcia";
$test_author = new Author($name);
$test_author->save();
$name2 = "Frank Sinatra";
$test_author2 = new Author($name2);
$test_author2->save();
$result = Author::searchAuthor($test_author->getName());
$this->assertEquals($test_author, $result);
}
示例13: getGS
$image = Image::OnImageUpload($_FILES['file'], $attributes);
if (PEAR::isError($image)) {
camp_html_add_msg($image->getMessage());
} else {
$author->setImage($image->getImageId());
}
}
$aliases = Input::Get("alias", "array");
if (!empty($aliases)) {
$author->setAliases($aliases);
}
if ($isNewAuthor) {
$logtext = getGS('New author "$1" ($2) created.',
$author->getName(), $author->getId());
Log::Message($logtext, $g_user->getUserId(), 172);
} else {
$logtext = getGS('Author information has been changed for "$1" ($2)',
$author->getName(), $author->getId());
Log::Message($logtext, $g_user->getUserId(), 173);
}
camp_html_add_msg(getGS("Author saved."),"ok");
} elseif ($del_id_alias < 1 && $id > -1 && !$can_save) {
camp_html_add_msg(getGS("Please fill at least first name and last name."));
}
if (!$id || $id == -1) {
$author = new Author(1);
if ($id == -1) {
$id = 0;
示例14: showName
/**
* @return string
*/
public function showName()
{
return $this->html($this->author->getName());
}
示例15: camp_set_author
function camp_set_author(ArticleTypeField $p_sourceField, &$p_errors)
{
$translator = \Zend_Registry::get('container')->getService('translator');
$p_errors = array();
$articles = Article::GetArticlesOfType($p_sourceField->getArticleType());
foreach ($articles as $article) {
$articleData = $article->getArticleData();
$authorName = trim($articleData->getFieldValue($p_sourceField->getPrintName()));
if (empty($authorName)) {
continue;
}
$author = new Author($authorName);
if (!$author->exists()) {
if (!$author->create()) {
$p_errors[] = $translator->trans('Unable to create author $1 for article no. $2 ($3) of type $4.', array('$1' => $author->getName(), '$2' => $article->getArticleNumber(), '$3' => $article->getName(), '$4' => $article->getType()), 'home');
continue;
}
}
if (!$article->setAuthorId($author->getId())) {
$p_errors[] = $translator->trans('Error setting the author $1 for article no. $2 ($3) of type $4.', array('$1' => $author->getName(), '$2' => $article->getArticleNumber(), '$3' => $article->getName(), '$4' => $article->getType()), 'home');
continue;
}
}
$cacheService = \Zend_Registry::get('container')->getService('newscoop.cache');
$cacheService->clearNamespace('authors');
$cacheService->clearNamespace('article');
return count($p_errors);
}