PHP Classes

File: test/SchemaTest.php

Recommend this page to a friend!
  Classes of adeniyi ibraheem  >  Potato ORM  >  test/SchemaTest.php  >  Download  
File: test/SchemaTest.php
Role: Unit test script
Content type: text/plain
Description: Unit test script
Class: Potato ORM
Store and retrieve objects in databases using ORM
Author: By
Last change:
Date: 4 years ago
Size: 2,179 bytes
 

Contents

Class file image Download
<?php

namespace Ibonly\PotatoORM\Test;

use
PDO;
use
Mockery;
use
Ibonly\PotatoORM\Schema;

class
SchemaTest extends \PHPUnit_Framework_TestCase
{
   
/**
     * Define class initialization
     */
   
public function setUp()
    {
       
$this->schema = new Schema();
    }

   
/**
     * testIncrements
     * Test if AUTO_INCREMENT is present in returned data
     */
   
public function testIncrements()
    {
       
$this->assertContains('AUTO_INCREMENT', $this->schema->increments('id'));
    }

   
/**
     * testStrings
     * Test if varchar is present in returned data
     */
   
public function testStrings()
    {
       
$this->assertContains('varchar', $this->schema->strings('name', 20));
    }

   
/**
     * testText
     * Test if text is present in returned data
     */
   
public function testText()
    {
       
$this->assertContains('text', $this->schema->text('id'));
    }

   
/**
     * testInteger
     * Test if int is present in returned data
     */
   
public function testInteger()
    {
       
$this->assertContains('int', $this->schema->integer('age', 5));
    }

   
/**
     * testPrimaryKey
     * Test if KEY is present in returned data
     */
   
public function testPrimaryKey()
    {
       
$this->assertContains('KEY', $this->schema->primaryKey('id'));
    }

   
/**
     * testUnique
     * Test if UNIQUE is present in returned data
     */
   
public function testUnique()
    {
       
$this->assertContains('UNIQUE', $this->schema->unique('email'));
    }

   
/**
     * testForeignKey
     * Test if FOREIGN is present in returned data
     */
   
public function testForeignKey()
    {
       
$this->assertContains('FOREIGN', $this->schema->foreignKey('id', 'user_id'));
    }

   
/**
     * testBuildQuery
     * Test if string is present in returned data
     */
   
public function testBuildQuery()
    {
       
$this->assertInternalType("string", $this->schema->buildQuery('schools'));
    }

   
/**
     * testSanitizeQuery
     * Test if ); is present in returned data
     */
   
public function testSanitizeQuery()
    {
       
$this->assertContains(');', $this->schema->sanitizeQuery('email'));
    }
}


For more information send a message to info at phpclasses dot org.