[Argil-svn] SF.net SVN: argil: [495] trunk/tests/Argil
Status: Alpha
Brought to you by:
tswicegood
|
From: <tsw...@us...> - 2007-02-21 15:47:11
|
Revision: 495
http://argil.svn.sourceforge.net/argil/?rev=495&view=rev
Author: tswicegood
Date: 2007-02-21 07:47:08 -0800 (Wed, 21 Feb 2007)
Log Message:
-----------
Modify failing tests so they work with the latest PHPUnit.
These are tested against PHPUnit3 SVN r521. There was bugs in prior version of PU3 that
made expectations give false positives.
Modified Paths:
--------------
trunk/tests/Argil/Database/Reflection/TableTest.php
trunk/tests/Argil/Model/MapperTest.php
trunk/tests/Argil/Model/MetaTest.php
trunk/tests/Argil/Model/Relationship/MapperTest.php
trunk/tests/Argil/ModelListTest.php
trunk/tests/Argil/ModelTest.php
trunk/tests/ArgilCore/Models/Finders/AllTest.php
trunk/tests/ArgilCore/Models/Finders/OneTest.php
trunk/tests/ArgilSample/TestCase.php
Modified: trunk/tests/Argil/Database/Reflection/TableTest.php
===================================================================
--- trunk/tests/Argil/Database/Reflection/TableTest.php 2007-02-21 01:06:13 UTC (rev 494)
+++ trunk/tests/Argil/Database/Reflection/TableTest.php 2007-02-21 15:47:08 UTC (rev 495)
@@ -28,9 +28,6 @@
public function testContainsTableNameBasedOnConstruct() {
$database = $this->getMock('ArgilImpl_Database_Reflection');
- $database->expects($this->once())
- ->method('getName')
- ->will($this->returnValue('argiltest'));
$table = new Argil_Database_Reflection_Table($database, $this->_tableName);
$this->assertSame("{$this->_tableName}", $table->getName());
@@ -41,7 +38,7 @@
$database->expects($this->atLeastOnce())
->method('getPDO')
->will($this->returnValue($this->_pdo));
- $database->expects($this->atLeastOnce())
+ $database->expects($this->any())
->method('getName')
->will($this->returnValue('argiltest'));
@@ -61,7 +58,7 @@
$database->expects($this->once())
->method('getPDO')
->will($this->returnValue($this->_pdo));
- $database->expects($this->once())
+ $database->expects($this->any())
->method('getName')
->will($this->returnValue('argiltest'));
Modified: trunk/tests/Argil/Model/MapperTest.php
===================================================================
--- trunk/tests/Argil/Model/MapperTest.php 2007-02-21 01:06:13 UTC (rev 494)
+++ trunk/tests/Argil/Model/MapperTest.php 2007-02-21 15:47:08 UTC (rev 495)
@@ -141,7 +141,7 @@
public function testCallsRemoveOnProvidedStorageOnRemove() {
$values = array('widget_id' => rand(100, 999), 'title' => rand(1000, 1999));
$storage = $this->getMock('ArgilImpl_Storage');
- $storage->expects($this->once())
+ $storage->expects($this->any())
->method('getRecord')
->will($this->returnValue($values));
$storage->expects($this->once())
Modified: trunk/tests/Argil/Model/MetaTest.php
===================================================================
--- trunk/tests/Argil/Model/MetaTest.php 2007-02-21 01:06:13 UTC (rev 494)
+++ trunk/tests/Argil/Model/MetaTest.php 2007-02-21 15:47:08 UTC (rev 495)
@@ -50,7 +50,7 @@
$widgetColumn = $this->getMock('ArgilImpl_Database_Reflection_Column');
- $widgetColumn->expects($this->exactly(2))
+ $widgetColumn->expects($this->atLeastOnce())
->method('getName')
->will($this->returnValue('widget_id'));
$widgetColumn->expects($this->once())
@@ -70,7 +70,7 @@
->will($this->returnValue(0));
$titleColumn = $this->getMock('ArgilImpl_Database_Reflection_Column');
- $titleColumn->expects($this->exactly(2))
+ $titleColumn->expects($this->atLeastOnce())
->method('getName')
->will($this->returnValue('title'));
$titleColumn->expects($this->once())
@@ -87,7 +87,7 @@
->will($this->returnValue(false));
$randomColumn = $this->getMock('ArgilImpl_Database_Reflection_Column');
- $randomColumn->expects($this->exactly(2))
+ $randomColumn->expects($this->atLeastOnce())
->method('getName')
->will($this->returnValue($this->_randomColumn));
$randomColumn->expects($this->once())
@@ -107,7 +107,7 @@
->will($this->returnValue(false));
$textAreaColumn = $this->getMock('ArgilImpl_Database_Reflection_Column');
- $textAreaColumn->expects($this->exactly(2))
+ $textAreaColumn->expects($this->atLeastOnce())
->method('getName')
->will($this->returnValue('text_area'));
$textAreaColumn->expects($this->once())
Modified: trunk/tests/Argil/Model/Relationship/MapperTest.php
===================================================================
--- trunk/tests/Argil/Model/Relationship/MapperTest.php 2007-02-21 01:06:13 UTC (rev 494)
+++ trunk/tests/Argil/Model/Relationship/MapperTest.php 2007-02-21 15:47:08 UTC (rev 495)
@@ -71,7 +71,7 @@
$idColumn->name = 'widget_id';
$model = $this->getMock('ArgilImpl_Model');
- $model->expects($this->exactly(2))
+ $model->expects($this->atLeastOnce())
->method('getName')
->will($this->returnValue('widget'));
$model->expects($this->any())
Modified: trunk/tests/Argil/ModelListTest.php
===================================================================
--- trunk/tests/Argil/ModelListTest.php 2007-02-21 01:06:13 UTC (rev 494)
+++ trunk/tests/Argil/ModelListTest.php 2007-02-21 15:47:08 UTC (rev 495)
@@ -59,7 +59,7 @@
'title' => array()
);
$meta = $this->getMock('ArgilImpl_Model_Meta');
- $meta->expects($this->atLeastOnce())
+ $meta->expects($this->any())
->method('getColumns')
->will($this->returnValue($columns));
@@ -196,7 +196,7 @@
'title' => array()
);
$meta = $this->getMock('ArgilImpl_Model_Meta');
- $meta->expects($this->atLeastOnce())
+ $meta->expects($this->any())
->method('getColumns')
->will($this->returnValue($columns));
Modified: trunk/tests/Argil/ModelTest.php
===================================================================
--- trunk/tests/Argil/ModelTest.php 2007-02-21 01:06:13 UTC (rev 494)
+++ trunk/tests/Argil/ModelTest.php 2007-02-21 15:47:08 UTC (rev 495)
@@ -14,7 +14,7 @@
public function setUp() {
// mock "init" method so it doesn't try to check config values
$meta = $this->getMock('ArgilImpl_Model_Meta');
- $meta->expects($this->atLeastOnce())
+ $meta->expects($this->any())
->method('getColumns')
->will($this->returnValue(
array(
Modified: trunk/tests/ArgilCore/Models/Finders/AllTest.php
===================================================================
--- trunk/tests/ArgilCore/Models/Finders/AllTest.php 2007-02-21 01:06:13 UTC (rev 494)
+++ trunk/tests/ArgilCore/Models/Finders/AllTest.php 2007-02-21 15:47:08 UTC (rev 495)
@@ -44,11 +44,6 @@
$meta->expects($this->atLeastOnce())
->method('getModelName')
->will($this->returnValue('Widget_Models_Widget'));
- $widgetId = $this->getMock('ArgilImpl_Model_Meta_Column');
- $widgetId->name = 'widget_id';
- $meta->expects($this->once())
- ->method('idColumn')
- ->will($this->returnValue($widgetId));
$subMeta->expects($this->atLeastOnce())
->method('getName')
@@ -56,11 +51,6 @@
$subMeta->expects($this->atLeastOnce())
->method('getModelName')
->will($this->returnValue('Widget_Models_Sub'));
- $subId = $this->getMock('ArgilImpl_Model_Meta_Column');
- $subId->name = 'sub_id';
- $subMeta->expects($this->once())
- ->method('idColumn')
- ->will($this->returnValue($subId));
$finder = new ArgilCore_Models_Finders_All($config, $meta);
$list = $finder->find($this->_randomId);
@@ -91,11 +81,6 @@
$meta->expects($this->atLeastOnce())
->method('getModelName')
->will($this->returnValue('Widget_Models_Widget'));
- $widgetId = $this->getMock('ArgilImpl_Model_Meta_Column');
- $widgetId->name = 'widget_id';
- $meta->expects($this->once())
- ->method('idColumn')
- ->will($this->returnValue($widgetId));
$finder = new ArgilCore_Models_Finders_All($config, $meta);
$filter = new Argil_Filter();
Modified: trunk/tests/ArgilCore/Models/Finders/OneTest.php
===================================================================
--- trunk/tests/ArgilCore/Models/Finders/OneTest.php 2007-02-21 01:06:13 UTC (rev 494)
+++ trunk/tests/ArgilCore/Models/Finders/OneTest.php 2007-02-21 15:47:08 UTC (rev 495)
@@ -79,7 +79,7 @@
'projects' => array('ArgilCore', 'Widget'),
));
$meta = $this->getMock('ArgilImpl_Model_Meta');
- $meta->expects($this->any())
+ $meta->expects($this->once())
->method('getColumns')
->will($this->returnValue(array()));
$meta->expects($this->once())
@@ -88,11 +88,6 @@
$meta->expects($this->atLeastOnce())
->method('getModelName')
->will($this->returnValue('Widget_Models_Widget'));
- $widgetId = $this->getMock('ArgilImpl_Model_Meta_Column');
- $widgetId->name = 'widget_id';
- $meta->expects($this->once())
- ->method('idColumn')
- ->will($this->returnValue($widgetId));
$finder = new ArgilCore_Models_Finders_one($config, $meta);
$filter = new Argil_Filter();
Modified: trunk/tests/ArgilSample/TestCase.php
===================================================================
--- trunk/tests/ArgilSample/TestCase.php 2007-02-21 01:06:13 UTC (rev 494)
+++ trunk/tests/ArgilSample/TestCase.php 2007-02-21 15:47:08 UTC (rev 495)
@@ -8,16 +8,17 @@
class ArgilSample_TestCase extends PHPUnit_Framework_TestCase
{
protected $_pdo = null;
+ protected $_dbName = 'argil_sample_dev';
public function setup() {
$this->_pdo = new PDO('mysql:host=localhost;', 'root', '');
- $this->_pdo->exec('DROP DATABASE IF EXISTS argilsample_dev');
- $this->_pdo->exec('CREATE DATABASE argilsample_dev');
- $this->_pdo->exec('USE argilsample_dev');
+ $this->_pdo->exec("DROP DATABASE IF EXISTS {$this->_dbName}");
+ $this->_pdo->exec("CREATE DATABASE {$this->_dbName}");
+ $this->_pdo->exec("USE {$this->_dbName}");
}
public function teardown() {
- $this->_pdo->exec('DROP DATABASE IF EXISTS argilsample_dev');
+ $this->_pdo->exec("DROP DATABASE IF EXISTS {$this->_dbName}");
unset($this->_pdo);
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|