PHP Classes

File: tests/eMapper/SQLite/EntityNamespaceTest.php

Recommend this page to a friend!
  Classes of Emmanuel Antico   eMapper   tests/eMapper/SQLite/EntityNamespaceTest.php   Download  
File: tests/eMapper/SQLite/EntityNamespaceTest.php
Role: Unit test script
Content type: text/plain
Description: Unit test script
Class: eMapper
Database abstraction layer that maps data types
Author: By
Last change:
Date: 10 years ago
Size: 1,729 bytes
 

Contents

Class file image Download
<?php
namespace eMapper\SQLite;

use
eMapper\AbstractEntityNamespaceTest;
use
eMapper\Engine\SQLite\SQLiteDriver;
use
eMapper\Mapper;
use
Acme\Type\RGBColorTypeHandler;

/**
 *
 * @author emaphp
 * @group namespace
 */
class EntityNamespaceTest extends AbstractEntityNamespaceTest {
    public function
build() {
       
$this->driver = new SQLiteDriver(SQLiteTest::$filename);
       
$this->mapper = new Mapper($this->driver);
       
$this->mapper->addType('Acme\RGBColor', new RGBColorTypeHandler());
    }
   
    public function
testMatches() {
       
$products = $this->mapper->execute('products.codeMatches', '9');
       
$this->assertCount(1, $products);
   
       
$products = $this->mapper->execute('products.codeMatches', '^IND');
       
$this->assertCount(3, $products);
   
       
$products = $this->mapper->execute('products.codeMatches', '^i');
       
$this->assertCount(0, $products);
    }
   
    public function
testNotMatches() {
       
$products = $this->mapper->execute('products.codeNotMatches', '9');
       
$this->assertCount(4, $products);
   
       
$products = $this->mapper->execute('products.codeNotMatches', '^IND');
       
$this->assertCount(2, $products);
   
       
$products = $this->mapper->execute('products.codeNotMatches', '^i');
       
$this->assertCount(5, $products);
    }
   
    public function
testIMatches() {
       
$products = $this->mapper->execute('products.codeIMatches', '^IND');
       
$this->assertCount(3, $products);
   
       
$products = $this->mapper->execute('products.codeIMatches', '^i');
       
$this->assertCount(3, $products);
    }
   
    public function
testNotIMatches() {
       
$products = $this->mapper->execute('products.codeNotIMatches', '^IND');
       
$this->assertCount(2, $products);
   
       
$products = $this->mapper->execute('products.codeNotIMatches', '^i');
       
$this->assertCount(2, $products);
    }
}
?>