if (this.skipPHPTests) {
System.out.println("PHP tests have been disabled.");
return;
}
House house = new House();
Rectangle base = new Rectangle();
base.setColor(Color.BLUE);
base.setHeight(80);
base.setWidth(80);
base.setLineStyle(LineStyle.solid);
base.setId("baseid");
house.setBase(base);
Rectangle door = new Rectangle();
door.setColor(Color.YELLOW);
door.setHeight(35);
door.setWidth(20);
door.setLineStyle(LineStyle.solid);
door.setId("doorId");
house.setDoor(door);
Circle knob = new Circle();
knob.setColor(Color.RED);
knob.setId("knobId");
knob.setLineStyle(LineStyle.dashed);
knob.setRadius(2);
house.setDoorKnob(knob);
Label label1 = new Label();
label1.setValue("bachelor-pad");
Label label2 = new Label();
label2.setValue("single-family-dwelling");
house.setLabels(Arrays.asList(label1, label2));
Triangle roof = new Triangle();
roof.setBase(84);
roof.setHeight(20);
roof.setColor(Color.YELLOW);
roof.setLineStyle(LineStyle.solid);
house.setRoof(roof);
Rectangle window = new Rectangle();
window.setColor(Color.YELLOW);
window.setHeight(10);
window.setWidth(10);
window.setLineStyle(LineStyle.solid);
house.setWindows(Arrays.asList(window));
Date date = new Date();
// house.setConstructedDate(new DateTime(date, DateTimeZone.UTC));
house = processThroughXml(house);
base = house.getBase();
assertSame(Color.BLUE, base.getColor());
assertSame(LineStyle.solid, base.getLineStyle());
assertEquals(80, base.getHeight());
assertEquals(80, base.getWidth());
assertEquals("baseid", base.getId());
door = house.getDoor();
assertSame(Color.YELLOW, door.getColor());
assertSame(LineStyle.solid, door.getLineStyle());
assertEquals(35, door.getHeight());
assertEquals(20, door.getWidth());
assertEquals("doorId", door.getId());
knob = house.getDoorKnob();
assertSame(Color.RED, knob.getColor());
assertSame(LineStyle.dashed, knob.getLineStyle());
assertEquals(2, knob.getRadius());
assertEquals("knobId", knob.getId());
List<String> labels = Arrays.asList("bachelor-pad", "single-family-dwelling");
house.getLabels().size();
for (Object l : house.getLabels()) {
Label label = (Label) l;
assertTrue(labels.contains(label.getValue()));
}
roof = house.getRoof();
assertSame(Color.YELLOW, roof.getColor());
assertSame(LineStyle.solid, roof.getLineStyle());
assertNull(roof.getId());
assertEquals(84, roof.getBase());
assertEquals(20, roof.getHeight());
assertEquals(1, house.getWindows().size());
window = house.getWindows().get(0);
assertSame(Color.YELLOW, window.getColor());
assertSame(LineStyle.solid, window.getLineStyle());
assertEquals(10, window.getHeight());
assertEquals(10, window.getWidth());
assertNull(window.getId());
assertNull("constructed date should be null (php value type should not be serialized)", house.getConstructedDate());
//todo: figure out the timezone particulars.
//assertEquals(new DateTime(date, DateTimeZone.UTC), house.getConstructedDate());
}