public function testSerializeWithExclusions() { $a = new A(); $a->setRid(1); $a->setName('name'); $a->setStatus(true); $a->setHiddenStatus(true); $this->unitUnderTest->addExclusionSpecification(new GroupsSpecification(array('get'))); $result = $this->unitUnderTest->serialize($a); $expectedString = '{"status":true}'; $this->assertEquals($expectedString, $result); $this->unitUnderTest->addExclusionSpecification(new VersionSpecification('1.5')); $result = $this->unitUnderTest->serialize($a); $expectedString = '{"status":true}'; $this->assertEquals($expectedString, $result); $this->unitUnderTest->addExclusionSpecification(new VersionSpecification('2.5')); $result = $this->unitUnderTest->serialize($a); $expectedString = '[]'; $this->assertEquals($expectedString, $result); $this->unitUnderTest->cleanUpExclusionSpecifications(); $result = $this->unitUnderTest->serialize($a); $expectedString = '{"id":1,"name":"name","status":true}'; $this->assertEquals($expectedString, $result); }