Bijection between maps from a nice space to weakly homotopy equivalent spaces Let $S$ be a pointed topological space, that you can suppose nice (CW-complex, manifold, …), $X$, $Y$ be two (arbitrary) pointed topological spaces and $f:X\to{}Y$ a weak homotopy equivalence.
Let $[S, X]$ be the set of (pointed) maps between $S$ and $X$ up to homotopy, we have a canonical map $\phi:[S,X]\to[S,Y]$ (composition with $f$)
Is this map $\phi$ always a bijection? (and for what niceness of $S$?)
If $f$ is a homotopy equivalence (with a pointed inverse), then the answer is yes. If $S$ is a sphere, then the answer is yes by definition of weak homotopy equivalence, and if $S$ is the Hawaiian earring, then the answer can be no (for example take for $X$ the cone on the Hawaiian earring, see the introduction of http://arxiv.org/abs/1111.0731)
I’m asking this because I do not find very intuitive the definition of weak homotopy equivalence, we ask that $f$ is a bijection on the homotopy groups, but it would be equally natural to ask that $f$ is a bijection on maps from a torus, a lens space, or whatever.
 A: A map $f:X\to Y$ of unpointed spaces is a weak homotopy equivalence if and only if for every CW space $K$ the map $[K,X]\to [K,Y]$ induced by $f$ is a bijection. In particular this implies that if $X$ and $Y$ are themselves CW spaces (or homotopy equivalent to such) then $f$ must be a homotopy equivalence.
It might not be a bad idea to take the above as a definition of "weak homotopy equivalence", but the usual thing is to say instead that $f$ is a weak homotopy equivalence if (1) it induces a bijection $\pi_0(X)\to \pi_0(Y)$ of sets of path-components, and (2) for every $n>0$ and every point $x\in X$ (or equivalently for at least one point in every path-component) it induces an isomorphism $\pi_n(X,x)\to \pi_n(Y,f(x))$.
The latter condition is much easier to check, of course, but I'm with you: the former is a more appealing definition in a way.
The fact that the latter condition implies the former is somewhat nontrivial. Even the fact that the former implies the latter is a little bit nontrivial, since the one uses unpointed maps while the other uses pointed maps of spheres.
Curiously, it is possible for a map $X\to Y$ to induce bijections $[S^n,X]\to [S^n,Y]$ for all $n$ without being a weak homotopy equivalence: you just have to come up with a group homomorphism $G\to H$ that induces a bijection on conjugacy classes but is not an isomorphism, and then let $X$ and $Y$ be corresponding Eilenberg-MacLane spaces.
And it should also be noted that a map $X\to Y$ need not be a weak homotopy equivalence if it induces bijections $[(K,k),(X,x)]\to [(K,k),(Y,f(x)]$ for every pointed $K$ and every choice of $x\in X$: this definition lets you down, for example, if $X$ is empty.
Finally, if you are specifically interested in pointed spaces (but not necessarily path-connected) then the generally agreed upon definition is that a pointed map $(X,x)\to (Y,y)$ is a weak homotopy equivalence if the unpointed map $X\to Y$ is a weak homotopy equivalence. So the maps $\pi_n(X,x)\to \pi_n(Y,y)$ being isomorphisms, even including $n=0$, is not enough.
