예제 #1
0
 protected function tearDown()
 {
     Author::deleteAll();
     Book::deleteAll();
     Patron::deleteAll();
     Copies::deleteAll();
 }
 protected function tearDown()
 {
     Checkout::deleteAll();
     Book::deleteAll();
     Author::deleteAll();
     Patron::deleteAll();
 }
예제 #3
0
 protected function tearDown()
 {
     Copy::deleteAll();
     Book::deleteAll();
     Checkout::deleteAll();
     Patron::deleteAll();
 }
예제 #4
0
 protected function tearDown()
 {
     Book::deleteAll();
     Copy::deleteAll();
     Author::deleteAll();
     Patron::deleteAll();
 }
예제 #5
0
 function test_deleteAll()
 {
     //Arrange
     $title = "History of whatever";
     $test_book = new Book($title);
     $test_book->save();
     $title2 = "History of nothing";
     $test_book2 = new Book($title2);
     $test_book2->save();
     //Act
     Book::deleteAll();
     $result = Book::getAll();
     //Assert
     $this->assertEquals([], $result);
 }
예제 #6
0
파일: BookTest.php 프로젝트: bdspen/library
 function testDeleteAll()
 {
     //Arrange
     $title = "Title";
     $test_book = new Book($title);
     $test_book->save();
     $title2 = "New Title";
     $test_book2 = new Book($title2);
     $test_book2->save();
     //Act
     Book::deleteAll();
     $result = Book::getAll();
     //Assert
     $this->assertEquals([], $result);
 }
예제 #7
0
 function test_deleteAll()
 {
     //Arrange
     $title = "Sea Wolf";
     $test_book = new Book($title);
     $test_book->save();
     $title2 = "Eye of the World";
     $test_book2 = new Book($title2);
     $test_book2->save();
     //Act
     Book::deleteAll();
     $result = Book::getAll();
     //Assert
     $this->assertEquals([], $result);
 }
예제 #8
0
 function test_deleteAll()
 {
     //Arrange
     $title = "The Cat in the Hat";
     $test_book = new Book($title);
     $test_book->save();
     $title2 = "Misery";
     $test_book2 = new Book($title2);
     $test_book2->save();
     //Act
     Book::deleteAll();
     //Assert
     $result = Book::getAll();
     $this->assertEquals([], $result);
 }
예제 #9
0
 function testDeleteAll()
 {
     //Arrange
     $id = null;
     $name = "A Series of Unfortunate Events";
     $test_book = new Book($id, $name);
     $test_book->save();
     $name2 = "Fresh Off the Boat";
     $test_book2 = new Book($id, $name2);
     $test_book2->save();
     //Act
     Book::deleteAll();
     $result = Book::getAll();
     //Assert
     $this->assertEquals([], $result);
 }
예제 #10
0
 function testDeleteAll()
 {
     //Arrange
     $book_name = "Intro to Art";
     $test_book = new Book($book_name);
     $test_book->save();
     $book_name2 = "Intro to Spanish";
     $book_author2 = "SPN101";
     $test_book2 = new Book($book_name2);
     $test_book2->save();
     //Act
     Book::deleteAll();
     $result = Book::getAll();
     //Assert
     $this->assertEquals([], $result);
 }
예제 #11
0
 function testDeleteAll()
 {
     //Arrange
     $title = "Where the Red Fern Grows";
     $id = null;
     $test_book = new Book($title, $id);
     $test_book->save();
     $title2 = "Where the Wild Things Are";
     $test_book2 = new Book($title2, $id);
     $test_book2->save();
     //Act
     Book::deleteAll();
     //Assert
     $result = Book::getAll();
     $this->assertEquals([], $result);
 }
예제 #12
0
 function testDeleteAll()
 {
     //Arrange
     $title = "Harry Potter";
     $id = 1;
     $test_book = new Book($title, $id);
     $test_book->save();
     $title2 = "Moby Dick";
     $id2 = 2;
     $test_book2 = new Book($title, $id);
     $test_book2->save();
     //Act
     Book::deleteAll();
     $result = Book::getAll();
     //Assert
     $this->assertEquals([], $result);
 }
예제 #13
0
 function test_deleteAll()
 {
     //Arrange
     $title = "Whimsical Fairytales...and other stories";
     $genre = "Fantasy";
     $test_book = new Book($title, $genre);
     $test_book->save();
     $title2 = "The Secret Life of Garden Gnomes";
     $genre2 = "Nonfiction";
     $test_book2 = new Book($title2, $genre2);
     $test_book2->save();
     //Act
     Book::deleteAll();
     //Assert
     $result = Book::getAll();
     $this->assertEquals([], $result);
 }
예제 #14
0
 function test_deleteAll()
 {
     //Arrange
     $title = "World War Z";
     $genre = "Horror";
     $test_book = new Book($title, $genre);
     $test_book->save();
     $name2 = "Billy Bartle-Barnaby";
     $enroll_date2 = "2015-07-09";
     $test_book2 = new Book($name2, $enroll_date2);
     $test_book2->save();
     //Act
     Book::deleteAll();
     //Assert
     $result = Book::getAll();
     $this->assertEquals([], $result);
 }
예제 #15
0
 function test_deleteAll()
 {
     //Arrange
     $author_first = "Dr.";
     $author_last = "Seuss";
     $title = "The Cat in the Hat";
     $test_book = new Book($author_first, $author_last, $title);
     $test_book->save();
     $author_first2 = "Stephen";
     $author_last2 = "King";
     $title2 = "Misery";
     $test_book2 = new Book($author_first2, $author_last2, $title2);
     $test_book2->save();
     //Act
     Book::deleteAll();
     //Assert
     $result = Book::getAll();
     $this->assertEquals([], $result);
 }
예제 #16
0
 function testDeleteAll()
 {
     //Arrange
     $title = "Speaker for the Dead";
     $date = "1987";
     $id = null;
     $test_book = new Book($title, $date, $id);
     $test_book->save();
     $title2 = "Frankenstein";
     $date2 = "1750";
     $id2 = null;
     $test_book2 = new Book($title2, $date2, $id2);
     $test_book2->save();
     //Act
     Book::deleteAll();
     //Assert
     $result = Book::getAll();
     $this->assertEquals([], $result);
 }
예제 #17
0
$app->register(new Silex\Provider\TwigServiceProvider(), array('twig.path' => __DIR__ . '/../views'));
use Symfony\Component\HttpFoundation\Request;
Request::enableHttpMethodParameterOverride();
// HOME PAGE - DISPLAYS ADMIN LINK AND PATRON LINK
$app->get('/', function () use($app) {
    return $app['twig']->render('index.html.twig');
});
// ADMIN PAGE - DISPLAYS BOOK CATALOG
$app->get("/main_admin", function () use($app) {
    $books = Book::getAll();
    $authors = Author::getAll();
    return $app['twig']->render("main_admin.html.twig", array('books' => $books, 'authors' => $authors));
});
$app->post("/delete_books", function () use($app) {
    $GLOBALS['DB']->exec("DELETE FROM books;");
    Book::deleteAll();
    return $app['twig']->render('main_admin.html.twig', array('books' => Book::getAll()));
});
//add new book with author
$app->post("/book_added", function () use($app) {
    // create new book from user entry "add book"
    $title = $_POST['title'];
    $new_book = new Book($title);
    $new_book->save();
    // create new author from user entry "add book"
    // possibly check that the author is already in the database - NOT NOW
    $name_array = explode(',', $_POST['name']);
    foreach ($name_array as $name) {
        $new_author = new Author($name);
        $new_author->save();
        $new_book->addAuthor($new_author);
예제 #18
0
 protected function tearDown()
 {
     Book::deleteAll();
     Copy::deleteAll();
 }
예제 #19
0
 function test_deleteAll()
 {
     //Arrange
     $title = "Ben";
     $id = 1;
     $title2 = "Jeff";
     $id2 = 2;
     $test_book = new Book($title, $id);
     $test_book->save();
     $test_book2 = new Book($title2, 2, $id2);
     $test_book2->save();
     //Act
     Book::deleteAll();
     $result = Book::getAll();
     //Assert
     $this->assertEquals([], $result);
 }
예제 #20
0
 protected function tearDown()
 {
     Patron::deleteAll();
     Book::deleteAll();
 }
 protected function tearDown()
 {
     Author::deleteAll();
     Book::deleteAll();
 }
예제 #22
0
 protected function tearDown()
 {
     Author::deleteAll();
     Book::deleteAll();
     $GLOBALS['DB']->exec("DELETE FROM authors_books;");
 }
예제 #23
0
 function test_deleteAll()
 {
     //Arrange
     $title = "Adventures on Mars";
     $test_book = new Book($title);
     $test_book->save();
     $title2 = "Adventures on Mars 2 Adventure Harder";
     $test_book2 = new Book($title2);
     $test_book2->save();
     //Act
     Book::deleteAll();
     $result = Book::getAll();
     //Assert
     $this->assertEquals([], $result);
 }
예제 #24
0
 function test_deleteAll()
 {
     $title = "Poles, Sweat, and Chicken Strips: the definitive guide to Portland strip clubs";
     $id = 1;
     $test_book1 = new Book($title, $id);
     $test_book1->save();
     $title2 = "My dad my hero";
     $id2 = 2;
     $test_book2 = new Book($title2, $id2);
     $test_book2->save();
     Book::deleteAll();
     $result = Book::getAll();
     $this->assertEquals([], $result);
 }
예제 #25
0
 function test_deleteAll()
 {
     //Arrange
     $book_name = "Gattica";
     $id = 1;
     $test_book = new Book($book_name, $id);
     $test_book->save();
     $book_name2 = "How to run";
     $id2 = 2;
     $test_book2 = new Book($book_name2, $id2);
     $test_book2->save();
     //Act
     Book::deleteAll();
     $result = Book::getAll();
     //Assert
     $this->assertEquals([], $result);
 }
예제 #26
0
 function testDeleteAll()
 {
     //Arrange
     $title = "Grapes of Wrath";
     $id = 1;
     $test_book = new Book($title, $id);
     $test_book->save();
     $title2 = "Cannery Row";
     $id2 = 2;
     $test_book2 = new Book($title2, $id2);
     $test_book2->save();
     //Act
     Book::deleteAll();
     //Assert
     $result = Book::getAll();
     $this->assertEquals([], $result);
 }