PHP Classes
elePHPant
Icontem

File: tests/Is1DArrayThenDeleteReadOnlyTest.php

Recommend this page to a friend!
  Classes of Scott Arciszewski  >  EasyDB  >  tests/Is1DArrayThenDeleteReadOnlyTest.php  >  Download  
File: tests/Is1DArrayThenDeleteReadOnlyTest.php
Role: Class source
Content type: text/plain
Description: Class source
Class: EasyDB
Simple Database Abstraction Layer around PDO
Author: By
Last change: manually changing to squish "method name is not in camel caps format" style error
single-lining test classes after composer run fix-style
running composer run fix-style
Date: 1 year ago
Size: 1,663 bytes
 

Contents

Class file image Download
<?php
declare(strict_types=1);

namespace
ParagonIE\EasyDB\Tests;

use
InvalidArgumentException;

class
Is1DArrayThenDeleteReadOnlyTest extends EasyDBTest
{

   
/**
     * @dataProvider goodFactoryCreateArgument2EasyDBProvider
     * @depends ParagonIE\EasyDB\Tests\Is1DArrayTest::testIs1DArray
     * @param callable $cb
     */
   
public function testDeleteThrowsException(callable $cb)
    {
       
$db = $this->easyDBExpectedFromCallable($cb);
       
$this->expectException(InvalidArgumentException::class);
       
$db->delete('irrelevant_but_valid_tablename', [[1]]);
    }

   
/**
     * @dataProvider goodFactoryCreateArgument2EasyDBProvider
     * @param callable $cb
     */
   
public function testDeleteTableNameEmptyThrowsException(callable $cb)
    {
       
$db = $this->easyDBExpectedFromCallable($cb);
       
$this->expectException(InvalidArgumentException::class);
       
$db->delete('', ['foo' => 'bar']);
    }

   
/**
     * @dataProvider goodFactoryCreateArgument2EasyDBProvider
     * @param callable $cb
     */
   
public function testDeleteTableNameInvalidThrowsException(callable $cb)
    {
       
$db = $this->easyDBExpectedFromCallable($cb);
       
$this->expectException(InvalidArgumentException::class);
       
$db->delete('1foo', ['foo' => 'bar']);
    }

   
/**
     * @dataProvider goodFactoryCreateArgument2EasyDBProvider
     * @param callable $cb
     */
   
public function testDeleteConditionsReturnsNull(callable $cb)
    {
       
$db = $this->easyDBExpectedFromCallable($cb);
       
$this->assertEquals(
           
$db->delete('irrelevant_but_valid_tablename', []),
           
null
       
);
    }
}