dox Executable Documentation

Singleton

Singleton

Given the class definition 'class Singleton { function __construct(\\watoki\\factory\\Factory $factory) { $factory->setSingleton(__CLASS__, $this); } }'
When I get 'Singleton' from the factory
When I get 'Singleton' from the factory again
Then both instances should be the same object

Non existing singleton

When I try to get the singleton 'NonExistingSingleton'
Then an exception should be thrown

Get existing singleton

Given the class definition 'class SomeSingleton { function __construct(\\watoki\\factory\\Factory $factory, $arg) { $factory->setSingleton(__CLASS__, $this); $this->arg = $arg; } }'
When I get 'SomeSingleton' with arguments array('arg' => 'Special Argument') from the factory
When I try to get the singleton 'SomeSingleton'
Then the object should be an instance of 'SomeSingleton'
Then the the property 'arg' of the object should be 'Special Argument'