Browse Source

Tests that property is being set when defining the Association.

Ber Clausen 12 years ago
parent
commit
0bc07d78eb

+ 11 - 0
tests/TestCase/ORM/Association/BelongsToManyTest.php

@@ -1452,6 +1452,17 @@ class BelongsToManyTest extends TestCase {
 	}
 
 /**
+ * Tests that property is being set using the constructor options.
+ *
+ * @return void
+ */
+	public function testPropertyOption() {
+		$config = ['propertyName' => 'thing_placeholder'];
+		$association = new BelongsToMany('Thing', $config);
+		$this->assertEquals('thing_placeholder', $association->property());
+	}
+
+/**
  * Test that plugin names are omitted from property()
  *
  * @return void

+ 11 - 0
tests/TestCase/ORM/Association/BelongsToTest.php

@@ -347,6 +347,17 @@ class BelongsToTest extends \Cake\TestSuite\TestCase {
 	}
 
 /**
+ * Tests that property is being set using the constructor options.
+ *
+ * @return void
+ */
+	public function testPropertyOption() {
+		$config = ['propertyName' => 'thing_placeholder'];
+		$association = new BelongsTo('Thing', $config);
+		$this->assertEquals('thing_placeholder', $association->property());
+	}
+
+/**
  * Test that plugin names are omitted from property()
  *
  * @return void

+ 11 - 0
tests/TestCase/ORM/Association/HasManyTest.php

@@ -758,6 +758,17 @@ class HasManyTest extends \Cake\TestSuite\TestCase {
 	}
 
 /**
+ * Tests that property is being set using the constructor options.
+ *
+ * @return void
+ */
+	public function testPropertyOption() {
+		$config = ['propertyName' => 'thing_placeholder'];
+		$association = new hasMany('Thing', $config);
+		$this->assertEquals('thing_placeholder', $association->property());
+	}
+
+/**
  * Test that plugin names are omitted from property()
  *
  * @return void

+ 11 - 0
tests/TestCase/ORM/Association/HasOneTest.php

@@ -291,6 +291,17 @@ class HasOneTest extends \Cake\TestSuite\TestCase {
 	}
 
 /**
+ * Tests that property is being set using the constructor options.
+ *
+ * @return void
+ */
+	public function testPropertyOption() {
+		$config = ['propertyName' => 'thing_placeholder'];
+		$association = new hasOne('Thing', $config);
+		$this->assertEquals('thing_placeholder', $association->property());
+	}
+
+/**
  * Test that plugin names are omitted from property()
  *
  * @return void