  Cosmology is built on a relativistic understanding of gravity, where the
geometry of the Universe is dynamically determined by matter and energy. In the
cosmological concordance model, gravity is described by General Relativity, and
it is assumed that on large scales the Universe is homogeneous and isotropic.
These fundamental principles should be tested. In this thesis, we explore the
implications of breaking them.
  In order to understand possible modifications to gravity on cosmological
scales, we extend the formalism of parameterised post-Newtonian cosmology, an
approach for building cosmological tests of gravity that are consistent with
tests on astrophysical scales. We demonstrate how this approach can be used to
construct theory-independent equations for the cosmic expansion and its
first-order perturbations. Then, we apply the framework to observations of the
anisotropies in the cosmic microwave background. We use these to place novel
cosmological constraints on the evolution of the post-Newtonian parameters.
  We investigate the consequences of inhomogeneity and isotropy by developing a
new approach to studying anisotropy in the Universe, wherein we consider how an
anisotropic cosmology might emerge on large scales as a result of averaging
over inhomogeneous structures, and demonstrate how the emergent model is
affected by backreaction. We perform a detailed study of light propagation in a
wide class of inhomogeneous and anisotropic spacetimes, exploring the
conditions under which the Hubble diagram can be accurately predicted by an
anisotropic model constructed using explicit averaging, even in the presence of
large inhomogeneities. We show that observables calculated in a suitable
averaged description closely reproduce the true Hubble diagram on large scales,
as long as the spacetime possesses a well-defined homogeneity scale.
