Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- private $collection;
- const ONE = 1;
- const KLASS = 'Collection';
- const ELEMENT = 'any element';
- const PROPERTY = 'collection';
- public function testSizeOfTheCollectionReflectsNewElements()
- {
- $this->startWithAnEmptyCollection();
- $this->addAnyElementToTheCollection();
- $this->theSizeOfTheCollectionIsOne();
- }
- private function theSizeOfTheCollectionIsOne()
- {
- $this->theSizeOfTheCollectionIs($this->one());
- }
- private function one()
- {
- return self::ONE;
- }
- private function startWithAnEmptyCollection()
- {
- $this->setProperty($this->aProperty(), $this->anEmptyCollection());
- }
- private function aProperty()
- {
- return self::PROPERTY;
- }
- private function setProperty($name, $value)
- {
- $this->{$name} = $value;
- }
- private function anEmptyCollection()
- {
- return new $this->aClass;
- }
- private function aClass()
- {
- return self::KLASS;
- }
- private function addAnyElementToTheCollection()
- {
- $this->theCollection()->add($this->anyElement());
- }
- private function anyElement()
- {
- return self::ELEMENT;
- }
- private function theSizeOfTheCollectionIs($size)
- {
- $this->assertSame($size, $this->theSizeOfTheCollection());
- }
- private function theSizeOfTheCollection()
- {
- return count($this->theCollection());
- }
- private function theCollection()
- {
- return $this->collection;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement