当前位置: 首页>>代码示例>>PHP>>正文


PHP Checkout::getAll方法代码示例

本文整理汇总了PHP中Checkout::getAll方法的典型用法代码示例。如果您正苦于以下问题:PHP Checkout::getAll方法的具体用法?PHP Checkout::getAll怎么用?PHP Checkout::getAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Checkout的用法示例。


在下文中一共展示了Checkout::getAll方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: findDueDate

 static function findDueDate($search_id)
 {
     $found_checkout = null;
     $checkouts = Checkout::getAll();
     foreach ($checkouts as $checkout) {
         $checkout_id = $checkout->getId();
         if ($checkout_id == $search_id) {
             $found_checkout = $checkout;
         }
     }
     return $found_checkout;
 }
开发者ID:jlbethel,项目名称:library-1,代码行数:12,代码来源:Checkout.php

示例2: testSave

 function testSave()
 {
     //Arrange
     $copy_id = 1;
     $patron_id = 1;
     $id = 1;
     $due_date = '2015-10-10';
     $test_checkout = new Checkout($copy_id, $patron_id, $due_date, $id);
     $test_checkout->save();
     //Act
     $result = Checkout::getAll();
     //Assert
     $this->assertEquals($test_checkout, $result[0]);
 }
开发者ID:bborealis,项目名称:library-1,代码行数:14,代码来源:CheckoutTest.php

示例3: test_deleteAll

 function test_deleteAll()
 {
     //Arrange
     $due_date = "0001-01-01";
     $test_checkout = new Checkout($due_date);
     $test_checkout->save();
     $due_date2 = "2020-01-01";
     $test_checkout2 = new Checkout($due_date2);
     $test_checkout2->save();
     //Act
     Checkout::deleteAll();
     $result = Checkout::getAll();
     //Assert
     $this->assertEquals([], $result);
 }
开发者ID:jlbethel,项目名称:Library,代码行数:15,代码来源:CheckoutTest.php

示例4: testDeleteAll

 function testDeleteAll()
 {
     //Arrange
     $id = null;
     $patron_id = null;
     $copy_id = null;
     $due_date = "2012-12-12";
     $test_checkout = new Checkout($id, $patron_id, $copy_id, $due_date);
     $test_checkout->save();
     $due_date2 = "1989-09-04";
     $test_checkout2 = new Checkout($id, $patron_id, $copy_id, $due_date2);
     $test_checkout2->save();
     //Act
     Checkout::deleteAll();
     $result = Checkout::getAll();
     //Assert
     $this->assertEquals([], $result);
 }
开发者ID:kellimargaret,项目名称:2015.08.26.Library,代码行数:18,代码来源:CheckoutTest.php

示例5: testAddCheckout

 function testAddCheckout()
 {
     $title = "Three Blind Mice";
     $test_book = new Book($title);
     $test_book->save();
     $test_copy = new Copy($amount = 1, $test_book->getId());
     $test_copy->save();
     $name = "Joe Bongtana";
     $test_patron = new Patron($name);
     $test_patron->save();
     $due_date = "01-01-2016";
     $status = 1;
     $test_checkout = new Checkout($test_copy->getId(), $test_patron->getId(), $due_date, $status);
     $test_checkout->save();
     $test_patron->addCheckout($test_checkout);
     $result = Checkout::getAll();
     $this->assertEquals($test_checkout, $result);
 }
开发者ID:nathanhwyoung,项目名称:Library-2,代码行数:18,代码来源:PatronTest.php

示例6: test_deleteAll

 function test_deleteAll()
 {
     //Arrange
     $due_date = "0001-01-01";
     $copy_id = 1;
     $patron_id = 2;
     $test_checkout = new Checkout($due_date, $copy_id, $patron_id);
     $test_checkout->save();
     $due_date2 = "2020-01-01";
     $copy_id2 = 3;
     $patron_id2 = 4;
     $test_checkout2 = new Checkout($due_date2, $copy_id2, $patron_id2);
     $test_checkout2->save();
     //Act
     Checkout::deleteAll();
     $result = Checkout::getAll();
     //Assert
     $this->assertEquals([], $result);
 }
开发者ID:jlbethel,项目名称:library-1,代码行数:19,代码来源:CheckoutTest.php

示例7: test_deleteAll

 function test_deleteAll()
 {
     //Arrange
     $copy_id = 1;
     $patron_id = 4;
     $due_date = "2015-09-03";
     $test_checkout = new Checkout($copy_id, $patron_id, $due_date);
     $test_checkout->save();
     $copy_id2 = 2;
     $patron_id2 = 1;
     $due_date2 = "2015-10-05";
     $test_checkout2 = new Checkout($copy_id2, $patron_id2, $due_date2);
     $test_checkout2->save();
     //Act
     Checkout::deleteAll();
     //Assert
     $result = Checkout::getAll();
     $this->assertEquals([], $result);
 }
开发者ID:alexdbrown,项目名称:library,代码行数:19,代码来源:CheckoutTest.php

示例8: find

 static function find($search_id)
 {
     $found_checkout = null;
     $all_checkouts = Checkout::getAll();
     foreach ($all_checkouts as $checkout) {
         if ($checkout->getId() == $search_id) {
             $found_checkout = $checkout;
         }
     }
     return $found_checkout;
 }
开发者ID:r-hills,项目名称:library-1,代码行数:11,代码来源:Checkout.php

示例9: test_deleteAll

 function test_deleteAll()
 {
     //Arrange
     // Make a Patron
     $name = "Dan Brown";
     $phone = "3";
     $email = "a@a.com";
     $test_patron = new Patron($name, $phone, $email);
     $test_patron->save();
     // Make a Checkout and save
     $patron_id = $test_patron->getId();
     $copy_id = 1;
     $due_date = "2015-08-09";
     $test_checkout = new Checkout($patron_id, $copy_id, $due_date);
     $test_checkout->save();
     // Make a 2nd Checkout and save under the same patron
     $copy_id2 = 1;
     $due_date2 = "2015-08-09";
     $test_checkout2 = new Checkout($patron_id, $copy_id2, $due_date2);
     $test_checkout2->save();
     //Act
     Checkout::deleteAll();
     //Assert
     $result = Checkout::getAll();
     $this->assertEquals([], $result);
 }
开发者ID:r-hills,项目名称:Library,代码行数:26,代码来源:CheckoutTest.php

示例10: test_getAll

 function test_getAll()
 {
     // for now, feed a dummy copy_id just for testing
     // later, we will need to use getNextCopy() in Book class
     // to get a copy for a given book
     //Arrange
     // Make a Patron
     $name = "Dan Brown";
     $phone = "3";
     $email = "a@a.com";
     $test_patron = new Patron($name, $phone, $email);
     $test_patron->save();
     // Make a Checkout and save
     $patron_id = $test_patron->getId();
     $copy_id = 1;
     $date = "2015-08-09";
     $test_checkout = new Checkout($patron_id, $copy_id, $date);
     $test_checkout->save();
     // Make a 2nd Checkout and save under the same patron
     $copy_id2 = 1;
     $date2 = "2015-08-09";
     $test_checkout2 = new Checkout($patron_id, $copy_id2, $date2);
     $test_checkout2->save();
     //Act
     $result = Checkout::getAll();
     //Assert
     $this->assertEquals([$test_checkout, $test_checkout2], $result);
 }
开发者ID:ashlinaronin,项目名称:library,代码行数:28,代码来源:CheckoutTest.php

示例11: testGetAll

 function testGetAll()
 {
     $id = 1;
     $copy_id = 1;
     $patron_id = 1;
     $checkout_status = 0;
     $due_date = "2015-01-01";
     $test_checkout = new Checkout($patron_id, $copy_id, $due_date, $checkout_status, $id);
     $test_checkout->save();
     $id2 = 2;
     $copy_id2 = 2;
     $patron_id2 = 2;
     $checkout_status2 = 1;
     $due_date2 = "2015-02-02";
     $test_checkout2 = new Checkout($copy_id2, $patron_id2, $due_date2, $checkout_status2, $id2);
     $test_checkout2->save();
     $result = Checkout::getAll();
     $this->assertEquals([$test_checkout, $test_checkout2], $result);
 }
开发者ID:juliocesardiaz,项目名称:library-1,代码行数:19,代码来源:CheckoutTest.php

示例12: function

$app->post("/add_copy", function () use($app) {
    $book_id = $_POST['book_id'];
    $book = Book::find($book_id);
    $author = $book->getAuthors();
    $copy = new Copy($book_id);
    $copy->save();
    $copies = Copy::findCopies($book_id);
    return $app['twig']->render('book.html.twig', array('book' => $book, 'author' => $author, 'copies' => $copies, 'patrons' => Patron::getAll(), 'checkouts' => Checkout::getAll()));
});
$app->patch("/checkout_copy/{id}", function ($id) use($app) {
    $checkout = new Checkout($_POST['copy_id'], $_POST['patron_id'], $_POST['due_date']);
    $checkout->save();
    $book_id = $_POST['book_id'];
    $book = Book::find($book_id);
    $author = $book->getAuthors();
    return $app['twig']->render('book.html.twig', array('book' => $book, 'author' => $author, 'copies' => Copy::getAll(), 'patrons' => Patron::getAll(), 'checkouts' => Checkout::getAll()));
});
// $app->patch("/checkout_copy/{id}", function($id) use ($app) {
//     $book = Book::find($id);
//     $author = $book->getAuthors();
//     $copy_id = $_POST['copy_id'];
//     $copy = Copy::find($copy_id);
//     //$checkout = new Checkout($copy_id, $)
//     $copy->update($_POST['due_date']);
//     $copies = Copy::findCopies($id);
//     return $app['twig']->render('book.html.twig', array('book'=>$book, 'author'=>$author, 'copies'=> $copies, 'patrons'=>Patron::getAll()));
// });
$app->patch("/patron/{id}", function ($id) use($app) {
    $patron = Patron::find($id);
    $patron->update($_POST['name']);
    return $app['twig']->render('patron.html.twig', array('patron' => $patron));
开发者ID:bborealis,项目名称:library-1,代码行数:31,代码来源:app.php

示例13: test_delete

 function test_delete()
 {
     //Arrange
     $checked_in_status = 0;
     $due_date = "2000 BC";
     $copy_id = 4;
     $patron_id = 4;
     $test_checkout = new Checkout($checked_in_status, $due_date, $copy_id, $patron_id);
     $test_checkout->save();
     //Act
     $test_checkout->delete();
     $result = Checkout::getAll();
     //Assert
     $this->assertEquals([], $result);
 }
开发者ID:kevintokheim,项目名称:Library,代码行数:15,代码来源:CheckoutTest.php

示例14: test_updateReturned

 function test_updateReturned()
 {
     //Arrange
     $copy_id = 1;
     $patron_id = 4;
     $due_date = "2015-09-03";
     $test_checkout = new Checkout($copy_id, $patron_id, $due_date);
     $test_checkout->save();
     //Act
     $new_returned = true;
     $test_checkout->updateReturned($new_returned);
     //Assert
     $result = Checkout::getAll();
     $this->assertEquals($new_returned, $result[0]->getReturned());
 }
开发者ID:r-hills,项目名称:library-1,代码行数:15,代码来源:CheckoutTest.php

示例15: testSave

 function testSave()
 {
     $patron_name = "Randy Mclure";
     $test_patron = new Patron($patron_name);
     $test_patron->save();
     $due_date = "2015-09-10";
     $copy_id = 1;
     $patron_id = 1;
     $checkin_status = 1;
     $test_checkout = new Checkout($due_date, $copy_id, $test_patron->getId(), $checkin_status);
     $test_checkout->save($test_patron);
     $result = Checkout::getAll();
     $this->assertEquals($test_checkout, $result[0]);
 }
开发者ID:umamiMike,项目名称:library-1,代码行数:14,代码来源:CheckoutTest.php


注:本文中的Checkout::getAll方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。