protected function tearDown()
 {
     Checkout::deleteAll();
     Book::deleteAll();
     Author::deleteAll();
     Patron::deleteAll();
 }
Example #2
0
 protected function tearDown()
 {
     Author::deleteAll();
     Book::deleteAll();
     Patron::deleteAll();
     Copies::deleteAll();
 }
Example #3
0
 protected function tearDown()
 {
     Book::deleteAll();
     Copy::deleteAll();
     Author::deleteAll();
     Patron::deleteAll();
 }
Example #4
0
 protected function tearDown()
 {
     Book::deleteAll();
     Author::deleteAll();
     $GLOBALS['DB']->exec("DELETE FROM authors_books;");
     $GLOBALS['DB']->exec("DELETE FROM copies;");
 }
Example #5
0
 function testDeleteAll()
 {
     $author_name = "Murakami";
     $id = 1;
     $test_author = new Author($author_name, $id);
     $test_author->save();
     $author_name = "Linux";
     $test_author2 = new Author($author_name);
     $test_author2->save();
     Author::deleteAll();
     $result = Author::getAll();
     $this->assertEquals([], $result);
 }
Example #6
0
 function test_deleteAll()
 {
     //Arrange
     $name = "Bob";
     $test_author = new Author($name);
     $test_author->save();
     $name2 = "Billy Bob";
     $test_author2 = new Author($name2);
     $test_author2->save();
     //Act
     Author::deleteAll();
     $result = Author::getAll();
     //Assert
     $this->assertEquals([], $result);
 }
Example #7
0
 function test_deleteAll()
 {
     //Arrange
     $name = "Ashlin Aronin";
     $test_author = new Author($name);
     $test_author->save();
     $name2 = "Vincent Adultman";
     $test_author2 = new Author($name2);
     $test_author2->save();
     //Act
     Author::deleteAll();
     //Assert
     $result = Author::getAll();
     $this->assertEquals([], $result);
 }
Example #8
0
 function testDeleteAll()
 {
     //Arrange
     $name = "Intro to Art";
     $test_author = new Author($name);
     $test_author->save();
     $name2 = "Intro to Spanish";
     $test_author2 = new Author($name2);
     $test_author2->save();
     //Act
     Author::deleteAll();
     $result = Author::getAll();
     //Assert
     $this->assertEquals([], $result);
 }
 function test_deleteAll()
 {
     //Arrange
     $name = "J.K. Rowling";
     $test_author = new Author($name);
     $test_author->save();
     $name2 = "C.S. Lewis";
     $test_author2 = new Author($name2);
     $test_author2->save();
     //Act
     Author::deleteAll();
     //Assert
     $result = Author::getAll();
     $this->assertEquals([], $result);
 }
 function testDeleteAll()
 {
     //Arrange
     $id = null;
     $name = "Lemony Snicket";
     $test_author = new Author($id, $name);
     $test_author->save();
     $name2 = "J.R.R. Tolkien";
     $test_author2 = new Author($id, $name2);
     $test_author2->save();
     //Act
     Author::deleteAll();
     //Assert
     $result = Author::getAll();
     $this->assertEquals([], $result);
 }
Example #11
0
 function testDeleteAll()
 {
     //Arrange
     $name = "Nathan Young";
     $id = null;
     $test_author = new Author($name, $id);
     $test_author->save();
     $name2 = "Kyle Pratuch";
     $test_author2 = new Author($name2, $id);
     $test_author2->save();
     //Act
     Author::deleteAll();
     //Assert
     $result = Author::getAll();
     $this->assertEquals([], $result);
 }
Example #12
0
 function testDeleteAll()
 {
     //Arrange
     $name = "JK Rowling";
     $id = 1;
     $test_author = new Author($name, $id);
     $test_author->save();
     $name2 = "George RR Martin";
     $id2 = 2;
     $test_author2 = new Author($name, $id);
     $test_author2->save();
     //Act
     Author::deleteAll();
     $result = Author::getAll();
     //Assert
     $this->assertEquals([], $result);
 }
Example #13
0
 function test_deleteAll()
 {
     //Arrange
     $name = "Paul Jones";
     $id = 1;
     $name2 = "Steve Smith";
     $id2 = 2;
     $test_author = new Author($name, $id);
     $test_author->save();
     $test_author2 = new Author($name, $id2);
     $test_author2->save();
     //Act
     Author::deleteAll();
     $result = Author::getAll();
     //Assert
     $this->assertEquals([], $result);
 }
Example #14
0
$app->register(new Silex\Provider\TwigServiceProvider(), array('twig.path' => __DIR__ . '/../views'));
$app->get("/", function () use($app) {
    return $app['twig']->render('index.html.twig', array('books' => Book::getAll(), 'authors' => Author::getAll()));
});
$app->get("/books", function () use($app) {
    return $app['twig']->render('books.html.twig', array('books' => Book::getAll()));
});
$app->post("/books", function () use($app) {
    $book_title = $_POST['book_title'];
    $book = new Book($book_title);
    $book->save();
    return $app['twig']->render('books.html.twig', array('books' => Book::getAll()));
});
$app->post("/delete_books", function () use($app) {
    Book::deleteAll();
    return $app['twig']->render('books.html.twig', array('books' => Book::getAll()));
});
$app->get("/authors", function () use($app) {
    return $app['twig']->render('authors.html.twig', array('authors' => Author::getAll()));
});
$app->post("/authors", function () use($app) {
    $name = $_POST['name'];
    $author = new Author($name);
    $author->save();
    return $app['twig']->render('authors.html.twig', array('authors' => Author::getAll()));
});
$app->post("/delete_authors", function () use($app) {
    Author::deleteAll();
    return $app['twig']->render('authors.html.twig', array('authors' => Author::getAll()));
});
return $app;
Example #15
0
 protected function tearDown()
 {
     Book::deleteAll();
     Author::deleteAll();
     BookList::deleteAll();
 }
 public function testDeleteAllWithLimitAndOrder()
 {
     if (!$this->conn->acceptsLimitAndOrderForUpdateAndDelete()) {
         $this->markTestSkipped('Only MySQL & Sqlite accept limit/order with UPDATE clause');
     }
     $numAffected = Author::deleteAll(array('conditions' => array('parent_author_id = ?', 2), 'limit' => 1, 'order' => 'name asc'));
     $this->assertEquals(1, $numAffected);
     $this->assertTrue(strpos(Author::table()->lastSql, 'ORDER BY name asc LIMIT 1') !== false);
 }
Example #17
0
 function test_author_deleteAll()
 {
     //Arrange
     $id = 1;
     $author_name = "Whitman";
     $test_author = new Author($author_name, $id);
     $test_author->save();
     $id2 = 2;
     $author_name2 = "Twain";
     $test_author2 = new Author($author_name2, $id2);
     $test_author2->save();
     //Act
     Author::deleteAll();
     //Assert
     $result = Author::getAll();
     $this->assertEquals([], $result);
 }
Example #18
0
 function test_deleteAll()
 {
     //Arrange
     $name = "James Patterson";
     $id = 1;
     $name2 = "Stephen King";
     $id2 = 2;
     $test_author = new Author($name, $id);
     $test_author->save();
     $test_course2 = new Author($name2, 2, $id2);
     $test_course2->save();
     //Act
     Author::deleteAll();
     $result = Author::getAll();
     //Assert
     $this->assertEquals([], $result);
 }
Example #19
0
 function testDeleteAll()
 {
     //Arrange
     $first_name = "J.K.";
     $last_name = "Rowling";
     $test_author = new Author($first_name, $last_name);
     $test_author->save();
     $first_name2 = "John";
     $last_name2 = "Steinbeck";
     $test_author2 = new Author($first_name2, $last_name2);
     $test_author2->save();
     //Act
     Author::deleteAll();
     //Assert
     $result = Author::getAll();
     $this->assertEquals([], $result);
 }
Example #20
0
 function testDeleteAll()
 {
     //Arrange
     $author_name = "J.K. Rowling";
     $id = 1;
     $test_author = new Author($author_name, $id);
     $test_author->save();
     $author_name2 = "John Steinbeck";
     $id2 = 2;
     $test_author2 = new Author($author_name2, $id2);
     $test_author2->save();
     //Act
     Author::deleteAll();
     //Assert
     $result = Author::getAll();
     $this->assertEquals([], $result);
 }
Example #21
0
 function test_deleteAll()
 {
     //Arrange
     $name = "David Foster Wallace";
     $test_author = new Author($name);
     $test_author->save();
     $name2 = "Stephen King";
     $test_author2 = new Author($name2);
     $test_author2->save();
     //Act
     Author::deleteAll();
     $result = Author::getAll();
     //Assert
     $this->assertEquals([], $result);
 }
Example #22
0
 protected function tearDown()
 {
     Author::deleteAll();
 }
Example #23
0
 function testDeleteAll()
 {
     //Arrange
     $author_first = "J.K.";
     $author_last = "Rowling";
     $test_author = new Author($author_first, $author_last);
     $test_author->save();
     $author_first2 = "John";
     $author_last2 = "Steinbeck";
     $test_author2 = new Author($author_first2, $author_last2);
     $test_author2->save();
     //Act
     Author::deleteAll();
     //Assert
     $result = Author::getAll();
     $this->assertEquals([], $result);
 }
Example #24
0
 protected function tearDown()
 {
     //It doesn't like Book::deleteAll(), and there is nothing linking to Author.
     Book::deleteAll();
     Author::deleteAll();
 }
Example #25
0
 function test_deleteAll()
 {
     $name = "Dad";
     $id = 1;
     $test_author1 = new Author($name, $id);
     $test_author1->save();
     $name2 = "Uncle Ben";
     $id2 = 2;
     $test_author2 = new Author($name2, $id2);
     $test_author2->save();
     Author::deleteAll();
     $result = Author::getAll();
     $this->assertEquals([], $result);
 }
 /**
  * testCreationOfEmptyRecord method
  *
  * @return void
  */
 public function testCreationOfEmptyRecord()
 {
     $this->loadFixtures('Author');
     $TestModel = new Author();
     $this->assertEquals(4, $TestModel->find('count'));
     $TestModel->deleteAll(true, false, false);
     $this->assertEquals(0, $TestModel->find('count'));
     $result = $TestModel->save();
     $this->assertTrue(isset($result['Author']['created']));
     $this->assertTrue(isset($result['Author']['updated']));
     $this->assertEquals(1, $TestModel->find('count'));
 }
Example #27
0
 function test_deleteAll()
 {
     //Arrange
     $author_name = "Jack London";
     $test_author = new Author($author_name);
     $test_author->save();
     $author_name2 = "Robert Jordan";
     $test_author2 = new Author($author_name2);
     $test_author2->save();
     //Act
     Author::deleteAll();
     $result = Author::getAll();
     //Assert
     $this->assertEquals([], $result);
 }