X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=tests%2Flib%2Fpq%2FMapper%2FStorageTest.php;h=0889b13eb16c951e7cf3b3f4ecdbbf7df97e119b;hb=861bb294d28aba35e011d9d35aad750d93c7dbd7;hp=c57716269528a0741a5c9593615ef0303f0f5191;hpb=5c080bb03b5fee867da94cb3c1108d59529f741a;p=m6w6%2Fpq-gateway diff --git a/tests/lib/pq/Mapper/StorageTest.php b/tests/lib/pq/Mapper/StorageTest.php index c577162..0889b13 100644 --- a/tests/lib/pq/Mapper/StorageTest.php +++ b/tests/lib/pq/Mapper/StorageTest.php @@ -80,4 +80,18 @@ class StorageTest extends PHPUnit_Framework_TestCase $this->storage->discard(); $this->assertEquals("the day before", $this->storage->get(1)->data); } + + function testOf() { + $obj = $this->storage->get(1); + $ref = new Storage($this->mapper, RefTestModel::class); + $this->assertSame($obj->ref1, $ref->of($obj, "test")); + $this->assertSame($obj->ref2, $ref->of($obj, "another_test")); + } + + function testBy() { + $ref = new Storage($this->mapper, RefTestModel::class); + $obj = $ref->get([2,2]); + $this->assertSame($obj->one, $this->storage->by($obj, "test")); + $this->assertSame($obj->two, $this->storage->by($obj, "another_test")); + } }