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


PHP Collection::deleteAll方法代码示例

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


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

示例1: test_deleteAll

 function test_deleteAll()
 {
     //Arrange
     $name = "Hello Kitty";
     $name2 = "Pokemon";
     $test_collection = new Collection($name);
     $test_collection->save();
     $test_collection2 = new Collection($name2);
     $test_collection2->save();
     //Act
     Collection::deleteAll();
     $result = Collection::getAll();
     //Assert
     $this->assertEquals([], $result);
 }
开发者ID:Camolot,项目名称:inventory-PHP-databases,代码行数:15,代码来源:collectionTest.php

示例2: test_deleteAll

 function test_deleteAll()
 {
     //Arrange
     $thing = "Run the World";
     $thing2 = "20 20 Experience";
     $test_collection = new Collection($thing);
     $test_collection->save();
     $test_collection2 = new Collection($thing2);
     $test_collection2->save();
     //Act
     Collection::deleteAll();
     //Assert
     $result = Collection::getAll();
     $this->assertEquals([], $result);
 }
开发者ID:jmalo34,项目名称:Inventory_Collection,代码行数:15,代码来源:CollectionTest.php

示例3: PDO

Debug::enable();
$app = new Silex\Application();
// Set Silex debug mode in $app object
$app['debug'] = true;
$server = 'mysql:host=localhost;dbname=inventory';
$username = 'root';
$password = 'root';
$DB = new PDO($server, $username, $password);
$app->register(new Silex\Provider\TwigServiceProvider(), array('twig.path' => __DIR__ . '/../views'));
$app->get('/', function () use($app) {
    return $app['twig']->render('index.html.twig', array('collections' => Collection::getAll(), 'items' => Item::getAll()));
});
$app->post('/collection', function () use($app) {
    $collection = new Collection($_POST['name']);
    $collection->save();
    return $app['twig']->render('index.html.twig', array('collections' => Collection::getAll(), 'items' => Item::getAll()));
});
$app->post('/delete_collections', function () use($app) {
    Collection::deleteAll();
    return $app['twig']->render('index.html.twig', array('collections' => Collection::getAll(), 'items' => Item::getAll()));
});
$app->post('/item', function () use($app) {
    $item = new Item($_POST['name']);
    $item->save();
    return $app['twig']->render('index.html.twig', array('collections' => Collection::getAll(), 'items' => Item::getAll()));
});
$app->post('/delete_items', function () use($app) {
    Item::deleteAll();
    return $app['twig']->render('index.html.twig', array('collections' => Collection::getAll(), 'items' => Item::getAll()));
});
return $app;
开发者ID:Camolot,项目名称:inventory-PHP-databases,代码行数:31,代码来源:app.php

示例4: tearDown

 protected function tearDown()
 {
     Item::deleteAll();
     Collection::deleteAll();
 }
开发者ID:ben-pritchard,项目名称:inventory-PHP-databases,代码行数:5,代码来源:itemTest.php


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