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()); }
function test_getName() { //Arrange $name = "J.K. Rowling"; $test_author = new Author($name); //Act $result = $test_author->getName(); //Assert $this->assertEquals($name, $result); }
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); }
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()); }
function testUpdate() { //Arrange $name = "Paul Jones"; $id = 1; $test_author = new Author($name, $id); $test_author->save(); $new_name = "Steve Smith"; //Act $test_author->update($new_name); //Assert $this->assertEquals("Steve Smith", $test_author->getName()); }
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(); }
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); }
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); }
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); }
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'); }
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()); }
* * 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);
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); }
$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;
/** * @return string */ public function showName() { return $this->html($this->author->getName()); }
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); }
function test_update() { //Arrange $name = "Ashlin Aronin"; $test_author = new Author($name); $test_author->save(); //Act $new_name = "Sassy Ash"; $test_author->update($new_name); //Assert $this->assertEquals($new_name, $test_author->getName()); }
function testUpdate() { //Arrange $name = "Nathan Young"; $id = null; $test_author = new Author($name, $id); $test_author->save(); $new_name = "Kyle Pratuch"; //Act $test_author->update($new_name); //Assert $this->assertEquals("Kyle Pratuch", $test_author->getName()); }
function testUpdate() { //Arrange $id = null; $name = "lemony snicket"; $test_author = new Author($id, $name); $test_author->save(); $new_name = "Lemony Snicket"; //Act $test_author->update($new_name); //Assert $this->assertEquals($test_author->getName(), $new_name); }
public function testConstructorWithFormatRFC822() { $author = new Author('James Bond <*****@*****.**>'); $this->assertSame('James Bond', $author->getName()); $this->assertSame('*****@*****.**', $author->getEmail()); }