Cats become warriors when they show the ascets of one. It depends on training progress and how responsible and mature they are. But they can't be apprentices forever, and they can't be a warrior after a moon of training, so I guess they're required to train for 4-6 or 7 moons. Hope this makes it clear!
Yes it does depend on training progress, for example Firepaw was apprenticed after Sandstrorm & Dustpelt yet he was made a warrior before them. Also Medicine cat apprentices take longet to become Mediine cats.