summaryrefslogtreecommitdiff
path: root/server/vendor/php-opencloud/common/tests/unit/Common/HydratorStrategyTraitTes.php
diff options
context:
space:
mode:
authorEoleDev <root@serverpc.home>2016-03-09 15:37:42 +0100
committerEoleDev <root@serverpc.home>2016-03-09 15:37:42 +0100
commit1d3ed3af6d57316640c143002ddf80d61e6c098a (patch)
tree97ac49bc7ff0f16150aefee821da3557dc0d0644 /server/vendor/php-opencloud/common/tests/unit/Common/HydratorStrategyTraitTes.php
parentd69adc4f9d1f6019927de235ef84885c68e6e508 (diff)
parent08ea5ef31abcc4e23a39a780cacb64fa27f19194 (diff)
Merge branch 'Evan' into develop
Diffstat (limited to 'server/vendor/php-opencloud/common/tests/unit/Common/HydratorStrategyTraitTes.php')
-rw-r--r--server/vendor/php-opencloud/common/tests/unit/Common/HydratorStrategyTraitTes.php52
1 files changed, 52 insertions, 0 deletions
diff --git a/server/vendor/php-opencloud/common/tests/unit/Common/HydratorStrategyTraitTes.php b/server/vendor/php-opencloud/common/tests/unit/Common/HydratorStrategyTraitTes.php
new file mode 100644
index 0000000..6841002
--- /dev/null
+++ b/server/vendor/php-opencloud/common/tests/unit/Common/HydratorStrategyTraitTes.php
@@ -0,0 +1,52 @@
+<?php
+
+namespace OpenCloud\Test\Common;
+
+use OpenCloud\Common\HydratorStrategyTrait;
+use OpenCloud\Test\TestCase;
+
+class HydratorStrategyTraitTest extends TestCase
+{
+ private $fixture;
+
+ public function setUp()
+ {
+ $this->fixture = new Fixture();
+ }
+
+ public function test_it_hydrates()
+ {
+ $data = ['foo' => 1, 'bar' => 2, 'baz' => 3, 'boo' => 4];
+
+ $this->fixture->hydrate($data);
+
+ $this->assertEquals(1, $this->fixture->foo);
+ $this->assertEquals(2, $this->fixture->getBar());
+ $this->assertEquals(3, $this->fixture->getBaz());
+ }
+
+ public function test_it_hydrates_aliases()
+ {
+ $this->fixture->hydrate(['FOO!' => 1], ['FOO!' => 'foo']);
+
+ $this->assertEquals(1, $this->fixture->foo);
+ }
+}
+
+class Fixture
+{
+ public $foo;
+ protected $bar;
+ private $baz;
+
+ use HydratorStrategyTrait;
+
+ public function getBar()
+ {
+ return $this->bar;
+ }
+ public function getBaz()
+ {
+ return $this->baz;
+ }
+}