/** * Returns the name of the collection this object should be stored in * * @param string $collection * @return string */ public function collection($collection = null) { if (!is_null($collection)) { $this->Collection = $collection; } elseif (is_null($this->Collection)) { //defaults collection name to class name $this->Collection = Morph_Utils::collectionName($this); } return $this->Collection; }
public function testNamespacedCollectionName() { if (version_compare(PHP_VERSION, '5.3.0') === -1) { $this->markTestSkipped("Skipped for PHP Versions lower than 5.3.0"); return; } $object = $this->getMock('Morph_Object', array(), array(), 'user\\Profile'); $collectionName = Morph_Utils::collectionName($object); $this->assertEquals('user.Profile', $collectionName); }