本文整理汇总了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);
}
示例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);
}
示例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;
示例4: tearDown
protected function tearDown()
{
Item::deleteAll();
Collection::deleteAll();
}