Browse Source

Fix for TestFixture to use columnName as the key for the column type array.

It was causing an issue with SqlServer and binary columns in a fixture since SqlServer is quite pedantic on how columns are bound.
Walther Lalk 12 years ago
parent
commit
f22c980262

+ 1 - 1
src/TestSuite/Fixture/TestFixture.php

@@ -302,7 +302,7 @@ class TestFixture {
 		}
 		$fields = array_values(array_unique($fields));
 		foreach ($fields as $field) {
-			$types[] = $this->_schema->column($field)['type'];
+			$types[$field] = $this->_schema->column($field)['type'];
 		}
 		$default = array_fill_keys($fields, null);
 		foreach ($this->records as $record) {

+ 2 - 2
tests/TestCase/TestSuite/TestFixtureTest.php

@@ -234,7 +234,7 @@ class TestFixtureTest extends TestCase {
 
 		$query->expects($this->once())
 			->method('insert')
-			->with(['name', 'created'], ['string', 'datetime'])
+			->with(['name', 'created'], ['name' => 'string', 'created' => 'datetime'])
 			->will($this->returnSelf());
 
 		$query->expects($this->once())
@@ -285,7 +285,7 @@ class TestFixtureTest extends TestCase {
 
 		$query->expects($this->once())
 			->method('insert')
-			->with(['name', 'email', 'age'], ['string', 'string', 'integer'])
+			->with(['name', 'email', 'age'], ['name' => 'string', 'email' => 'string', 'age' => 'integer'])
 			->will($this->returnSelf());
 
 		$query->expects($this->once())