Permalink
Browse files

Merge pull request #255 from Ocramius/hotfix/DCOM-173-tests

Hotfix/dcom 173 tests
  • Loading branch information...
2 parents 963a632 + 75ba2ab commit e211821c719d33ad2cd1186fafb4dadb5f74d6ed @beberlei beberlei committed Feb 19, 2013
@@ -683,7 +683,7 @@ private function generateCloneImpl(ClassMetadata $class)
{
$hasParentClone = $class->getReflectionClass()->hasMethod('__clone');
$inheritDoc = $hasParentClone ? '{@inheritDoc}' : '';
- $callParentClone = $hasParentClone ? "\n parent::__clone();" : '';
+ $callParentClone = $hasParentClone ? "\n parent::__clone();\n" : '';
return <<<EOT
/**
@@ -0,0 +1,37 @@
+<?php
+
+namespace Doctrine\Tests\Common\Proxy;
+
+/**
+ * Test asset class
+ */
+class MagicCloneClass
+{
+ /**
+ * @var string
+ */
+ public $id = 'id';
+
+ /**
+ * @var string
+ */
+ public $publicField = 'publicField';
+
+ /**
+ * @var boolean
+ */
+ public $cloned = false;
+
+ /**
+ * @var string
+ */
+ public $clonedValue = 'defaultValue';
+
+ /**
+ * @return void
+ */
+ public function __clone()
+ {
+ $this->clonedValue = 'newClonedValue';
+ }
+}
@@ -0,0 +1,38 @@
+<?php
+
+namespace Doctrine\Tests\Common\Proxy;
+
+/**
+ * Test asset class
+ */
+class MagicGetClass
+{
+ /**
+ * @var string
+ */
+ public $id = 'id';
+
+ /**
+ * @var string
+ */
+ public $publicField = 'publicField';
+
+ /**
+ * @param $name
+ *
+ * @return string
+ * @throws \BadMethodCallException
+ */
+ public function __get($name)
+ {
+ if ($name === 'test') {
+ return 'test';
+ }
+
+ if ($name === 'publicField' || $name === 'id') {
+ throw new \BadMethodCallException('Should never be called for "publicField" or "id"');
+ }
+
+ return 'not defined';
+ }
+}
@@ -0,0 +1,38 @@
+<?php
+
+namespace Doctrine\Tests\Common\Proxy;
+
+/**
+ * Test asset class
+ */
+class MagicIssetClass
+{
+ /**
+ * @var string
+ */
+ public $id = 'id';
+
+ /**
+ * @var string
+ */
+ public $publicField = 'publicField';
+
+ /**
+ * @param string $name
+ *
+ * @return bool
+ * @throws \BadMethodCallException
+ */
+ public function __isset($name)
+ {
+ if ('test' === $name) {
+ return true;
+ }
+
+ if ('publicField' === $name || 'id' === $name) {
+ throw new \BadMethodCallException('Should never be called for "publicField" or "id"');
+ }
+
+ return false;
+ }
+}
@@ -0,0 +1,43 @@
+<?php
+
+namespace Doctrine\Tests\Common\Proxy;
+
+/**
+ * Test asset class
+ */
+class MagicSetClass
+{
+ /**
+ * @var string
+ */
+ public $id = 'id';
+
+ /**
+ * @var string
+ */
+ public $publicField = 'publicField';
+
+ /**
+ * @var string|null
+ */
+ public $testAttribute;
+
+ /**
+ * @param string $name
+ * @param mixed $value
+ *
+ * @throws \BadMethodCallException
+ */
+ public function __set($name, $value)
+ {
+ if ($name === 'test') {
+ $this->testAttribute = $value;
+ }
+
+ if ($name === 'publicField' || $name === 'id') {
+ throw new \BadMethodCallException('Should never be called for "publicField" or "id"');
+ }
+
+ $this->testAttribute = $value;
+ }
+}
@@ -0,0 +1,37 @@
+<?php
+
+namespace Doctrine\Tests\Common\Proxy;
+
+/**
+ * Test asset class
+ */
+class MagicSleepClass
+{
+ /**
+ * @var string
+ */
+ public $id = 'id';
+
+ /**
+ * @var string
+ */
+ public $publicField = 'publicField';
+
+ /**
+ * @var string
+ */
+ public $serializedField = 'defaultValue';
+
+ /**
+ * @var string
+ */
+ public $nonSerializedField = 'defaultValue';
+
+ /**
+ * @return array
+ */
+ public function __sleep()
+ {
+ return array('serializedField');
+ }
+}
@@ -0,0 +1,32 @@
+<?php
+
+namespace Doctrine\Tests\Common\Proxy;
+
+/**
+ * Test asset class
+ */
+class MagicWakeupClass
+{
+ /**
+ * @var string
+ */
+ public $id = 'id';
+
+ /**
+ * @var string
+ */
+ public $publicField = 'publicField';
+
+ /**
+ * @var string
+ */
+ public $wakeupValue = 'defaultValue';
+
+ /**
+ * @return void
+ */
+ public function __wakeup()
+ {
+ $this->wakeupValue = 'newWakeupValue';
+ }
+}
Oops, something went wrong.

0 comments on commit e211821

Please sign in to comment.