Skip to content

Commit

Permalink
Merge pull request #48 from superdweebie/tests-tidy
Browse files Browse the repository at this point in the history
Tidy up unserializer tests a little
  • Loading branch information
superdweebie committed Feb 26, 2014
2 parents c8e8994 + 7f154e9 commit 473a63b
Showing 1 changed file with 19 additions and 12 deletions.
31 changes: 19 additions & 12 deletions tests/Zoop/Shard/Test/Serializer/UnserializeModeTest.php
Expand Up @@ -57,14 +57,24 @@ public function testUnserializePatchGeneral()
],
'active' => false
],
self::USER_CLASS,
$user
self::USER_CLASS
);

$this->assertEquals('there', $updated->location());
$this->assertEquals('superdweebie', $updated->getUsername());
$this->assertEquals('Tom', $updated->getProfile()->getFirstname());
$this->assertEquals(false, $updated->getActive());

//also check that the updated doc persists correctly
$documentManager->flush();
$documentManager->clear();

$updated = $documentManager->getRepository(get_class($user))->find($id);

$this->assertEquals('there', $updated->location());
$this->assertEquals('superdweebie', $updated->getUsername());
$this->assertEquals('Tom', $updated->getProfile()->getFirstname());
$this->assertEquals(false, $updated->getActive());
}

public function testUnserializePatchAddItemToCollection()
Expand All @@ -91,8 +101,7 @@ public function testUnserializePatchAddItemToCollection()
'id' => $id,
'groups' => $groups
],
self::USER_CLASS,
$user
self::USER_CLASS
);

// this works pre flush
Expand Down Expand Up @@ -137,8 +146,7 @@ public function testUnserializePatchRemoveItemFromCollection()
'id' => $id,
'groups' => $groups
],
self::USER_CLASS,
$user
self::USER_CLASS
);

$userGroups = $updated->getGroups();
Expand Down Expand Up @@ -173,8 +181,7 @@ public function testUnserializePatchEmptyCollection()
'id' => $id,
'groups' => []
],
self::USER_CLASS,
$user
self::USER_CLASS
);
$this->assertCount(0, $updated->getGroups());

Expand Down Expand Up @@ -212,7 +219,7 @@ public function testUnserializeUpdateGeneral()
]
],
self::USER_CLASS,
$user,
null,
Unserializer::UNSERIALIZE_UPDATE
);

Expand Down Expand Up @@ -247,7 +254,7 @@ public function testUnserializeUpdateAddItemToCollection()
'groups' => $groups
],
self::USER_CLASS,
$user,
null,
Unserializer::UNSERIALIZE_UPDATE
);

Expand Down Expand Up @@ -290,7 +297,7 @@ public function testUnserializeUpdateRemoveItemFromCollection()
'groups' => $groups
],
self::USER_CLASS,
$user,
null,
Unserializer::UNSERIALIZE_UPDATE
);

Expand Down Expand Up @@ -326,7 +333,7 @@ public function testUnserializeUpdateEmptyCollection()
'groups' => []
],
self::USER_CLASS,
$user,
null,
Unserializer::UNSERIALIZE_UPDATE
);

Expand Down

0 comments on commit 473a63b

Please sign in to comment.