From: Marcus Ramberg <mramberg@cpan.org>
Date: Fri, 29 Jul 2005 11:41:42 +0000 (+0000)
Subject: added objectindex tests for search and add
X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=451517e7031ac72038f54a9750fac60dab0a4b3c;p=dbsrgits%2FDBIx-Class-Historic.git

added objectindex tests for search and add
---

diff --git a/t/cdbi-t/02-Film.t b/t/cdbi-t/02-Film.t
index 1a0c7b3..f47db3b 100644
--- a/t/cdbi-t/02-Film.t
+++ b/t/cdbi-t/02-Film.t
@@ -4,7 +4,7 @@ $| = 1;
 
 BEGIN {
 	eval "use DBD::SQLite";
-	plan $@ ? (skip_all => 'needs DBD::SQLite for testing') : (tests => 93);
+	plan $@ ? (skip_all => 'needs DBD::SQLite for testing') : (tests => 95);
 }
 
 INIT {
@@ -359,6 +359,10 @@ SKIP: {
 	is Scalar::Util::refaddr($btaste), Scalar::Util::refaddr($btaste2),
 		"Retrieving twice gives ref to same object";
 
+	my ($btaste5) = Film->search(title=>'Bad Taste');
+	is Scalar::Util::refaddr($btaste), Scalar::Util::refaddr($btaste5),
+		"Searching also gives ref to same object";
+
 	$btaste2->remove_from_object_index;
 	my $btaste3 = Film->retrieve('Bad Taste');
 	isnt Scalar::Util::refaddr($btaste2), Scalar::Util::refaddr($btaste3),
@@ -368,4 +372,15 @@ SKIP: {
 	my $btaste4 = Film->retrieve('Bad Taste');
 	isnt Scalar::Util::refaddr($btaste2), Scalar::Util::refaddr($btaste4),
 		"Clearing cache and retrieving again gives new object";
+ 
+  $btaste=Film->create({
+		Title             => 'Bad Taste 2',
+		Director          => 'Peter Jackson',
+		Rating            => 'R',
+		NumExplodingSheep => 2,
+	});
+	$btaste2 = Film->retrieve('Bad Taste 2');
+	is Scalar::Util::refaddr($btaste), Scalar::Util::refaddr($btaste2),
+		"Creating and retrieving gives ref to same object";
+ 
 }