File: tests/eMapper/MySQL/EntityNamespaceTest.php

Recommend this page to a friend!
  Classes of Emmanuel Antico  >  eMapper  >  tests/eMapper/MySQL/EntityNamespaceTest.php  >  Download  
File: tests/eMapper/MySQL/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: 6 years ago
Size: 1,829 bytes
 

Contents

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

use
eMapper\AbstractEntityNamespaceTest;
use
eMapper\Engine\MySQL\MySQLDriver;
use
eMapper\Mapper;
use
Acme\Type\RGBColorTypeHandler;

/**
 *
 * @author emaphp
 * @group mysql
 * @group namespace
 */
class EntityNamespaceTest extends AbstractEntityNamespaceTest {
    public function
build() {
       
$config = MySQLTest::$config;
       
$this->driver = new MySQLDriver($config['database'], $config['host'], $config['user'], $config['password']);
       
$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);
    }
}
?>


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