Permalink
Browse files

Tweaked ctype_upper check and added tests.

  • Loading branch information...
1 parent 69d87b3 commit 8e9b71d67ffb0670ee19a16e35fb6db5ff136131 Gabor de Mooij committed Dec 16, 2012
Showing with 13 additions and 5 deletions.
  1. +2 −2 RedBean/OODBBean.php
  2. +11 −3 testing/RedUNIT/Blackhole/Misc.php
View
@@ -392,7 +392,7 @@ public function &__get( $property ) {
$this->properties[$property] = $bean;
return $this->properties[$property];
}
- if (strpos($property,'own')===0 && ctype_upper(substr($property,3))) {
+ if (strpos($property,'own')===0 && ctype_upper(substr($property,3,1))) {
$type = (__lcfirst(str_replace('own','',$property)));
if ($this->aliasName) {
$myFieldLink = $this->aliasName.'_id';
@@ -408,7 +408,7 @@ public function &__get( $property ) {
$this->setMeta('tainted',true);
return $this->properties[$property];
}
- if (strpos($property,'shared')===0 && ctype_upper(substr($property,3))) {
+ if (strpos($property,'shared')===0 && ctype_upper(substr($property,6,1))) {
$type = (__lcfirst(str_replace('shared','',$property)));
$keys = $toolbox->getRedBean()->getAssociationManager()->related($this,$type);
if (!count($keys)) $beans = array(); else
@@ -143,9 +143,17 @@ public function run() {
R::$redbean->setBeanHelper( new RedBean_BeanHelper_Facade() );
pass();
-
-
-
+ //test whether properties like owner and shareditem are still possible
+ testpack('Test Bean Interface for Lists');
+ $bean = R::dispense('bean');
+ asrt(is_array($bean->owner),false); //must not be list, because first char after own is lowercase
+ asrt(is_array($bean->shareditem),false); //must not be list, because first char after shared is lowercase
+ asrt(is_array($bean->own),false);
+ asrt(is_array($bean->shared),false);
+ asrt(is_array($bean->own_item),false);
+ asrt(is_array($bean->shared_item),false);
+ asrt(is_array($bean->{'own item'}),false);
+ asrt(is_array($bean->{'shared Item'}),false);
}
}

0 comments on commit 8e9b71d

Please sign in to comment.