This commit is contained in:
Xes
2025-08-14 22:41:49 +02:00
parent 2de81ccc46
commit 8ce45119b6
39774 changed files with 4309466 additions and 0 deletions

5
vendor/sylius/attribute/.gitignore vendored Normal file
View File

@@ -0,0 +1,5 @@
vendor/
bin/
composer.phar
composer.lock

15
vendor/sylius/attribute/.travis.yml vendored Normal file
View File

@@ -0,0 +1,15 @@
language: php
php:
- 5.3
- 5.4
- 5.5
before_script: composer install --dev --prefer-source
script: bin/phpspec run -fpretty --verbose
notifications:
email: "travis-ci@sylius.org"
irc: "irc.freenode.org#sylius-dev"

6
vendor/sylius/attribute/CHANGELOG.md vendored Normal file
View File

@@ -0,0 +1,6 @@
CHANGELOG
=========
### v0.10.0
* Initial dev release.

19
vendor/sylius/attribute/LICENSE vendored Normal file
View File

@@ -0,0 +1,19 @@
Copyright (c) 2011-2015 Paweł Jędrzejewski
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@@ -0,0 +1,203 @@
<?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sylius\Component\Attribute\Model;
use Sylius\Component\Translation\Model\AbstractTranslatable;
/**
* Model for object attributes.
*
* @author Paweł Jędrzejewski <pawel@sylius.org>
* @author Gonzalo Vilaseca <gvilaseca@reiss.co.uk>
*/
class Attribute extends AbstractTranslatable implements AttributeInterface
{
/**
* Attribute id.
*
* @var mixed
*/
protected $id;
/**
* Type.
*
* @var string
*/
protected $type = AttributeTypes::TEXT;
/**
* Internal name.
*
* @var string
*/
protected $name;
/**
* Attribute configuration.
*
* @var array
*/
protected $configuration = array();
/**
* Creation time.
*
* @var \DateTime
*/
protected $createdAt;
/**
* Last update time.
*
* @var \DateTime
*/
protected $updatedAt;
public function __construct()
{
parent::__construct();
$this->createdAt = new \DateTime();
}
/**
* {@inheritdoc}
*/
public function __toString()
{
return $this->name;
}
/**
* {@inheritdoc}
*/
public function getId()
{
return $this->id;
}
/**
* {@inheritdoc}
*/
public function getName()
{
return $this->name;
}
/**
* {@inheritdoc}
*/
public function setName($name)
{
$this->name = $name;
return $this;
}
/**
* {@inheritdoc}
*/
public function getPresentation()
{
return $this->translate()->getPresentation();
}
/**
* {@inheritdoc}
*/
public function setPresentation($presentation)
{
$this->translate()->setPresentation($presentation);
return $this;
}
/**
* {@inheritdoc}
*/
public function getType()
{
return $this->type;
}
/**
* {@inheritdoc}
*/
public function setType($type)
{
$this->type = $type;
return $this;
}
/**
* {@inheritdoc}
*/
public function getConfiguration()
{
return $this->configuration;
}
/**
* {@inheritdoc}
*/
public function setConfiguration(array $configuration)
{
$this->configuration = $configuration;
return $this;
}
/**
* {@inheritdoc}
*/
public function getCreatedAt()
{
return $this->createdAt;
}
/**
* {@inheritdoc}
*/
public function setCreatedAt(\DateTime $createdAt)
{
$this->createdAt = $createdAt;
return $this;
}
/**
* {@inheritdoc}
*/
public function getUpdatedAt()
{
return $this->updatedAt;
}
/**
* {@inheritdoc}
*/
public function setUpdatedAt(\DateTime $updatedAt)
{
$this->updatedAt = $updatedAt;
return $this;
}
/**
* {@inheritdoc}
*/
protected function getTranslationEntityClass()
{
return get_class().'Translation';
}
}

View File

@@ -0,0 +1,65 @@
<?php
/*
* This file is part of the Sylius package.
*
* (c); Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sylius\Component\Attribute\Model;
use Sylius\Component\Resource\Model\TimestampableInterface;
/**
* Attribute interface.
*
* @author Paweł Jędrzejewski <pawel@sylius.org>
* @author Gonzalo Vilaseca <gvilaseca@reiss.co.uk>
*/
interface AttributeInterface extends TimestampableInterface, AttributeTranslationInterface
{
/**
* Get internal name.
*
* @return string
*/
public function getName();
/**
* Set internal name.
*
* @param string $name
*/
public function setName($name);
/**
* The type of the attribute.
*
* @return string
*/
public function getType();
/**
* Set type of the attribute.
*
* @param string $type
*/
public function setType($type);
/**
* Get attribute configuration.
*
* @return array
*/
public function getConfiguration();
/**
* Set attribute configuration.
*
* @param array $configuration
*/
public function setConfiguration(array $configuration);
}

View File

@@ -0,0 +1,78 @@
<?php
/*
* This file is part of the Sylius package.
*
* (c); Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sylius\Component\Attribute\Model;
use Doctrine\Common\Collections\Collection;
/**
* Interface implemented by object which can be characterized
* using the attributes.
*
* @author Paweł Jędrzejewski <pawel@sylius.org>
*/
interface AttributeSubjectInterface
{
/**
* Returns all attributes of the subject.
*
* @return Collection|AttributeValueInterface[]
*/
public function getAttributes();
/**
* Sets all attributes of the subject.
*
* @param Collection $attributes Array of AttributeValueInterface
*/
public function setAttributes(Collection $attributes);
/**
* Adds an attribute to the subject.
*
* @param AttributeValueInterface $attribute
*/
public function addAttribute(AttributeValueInterface $attribute);
/**
* Removes an attribute from the subject.
*
* @param AttributeValueInterface $attribute
*/
public function removeAttribute(AttributeValueInterface $attribute);
/**
* Checks whether the subject has a given attribute.
*
* @param AttributeValueInterface $attribute
*
* @return Boolean
*/
public function hasAttribute(AttributeValueInterface $attribute);
/**
* Checks whether the subject has a given attribute, access by name.
*
* @param string $attributeName
*
* @return Boolean
*/
public function hasAttributeByName($attributeName);
/**
* Returns an attribute of the subject by its name.
*
* @param string $attributeName
*
* @return AttributeValueInterface
*/
public function getAttributeByName($attributeName);
}

View File

@@ -0,0 +1,63 @@
<?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sylius\Component\Attribute\Model;
use Sylius\Component\Translation\Model\AbstractTranslation;
/**
* Model for object attributes translation.
*
* @author Gonzalo Vilaseca <gvilaseca@reiss.co.uk>
*/
class AttributeTranslation extends AbstractTranslation implements AttributeTranslationInterface
{
/**
* Attribute id.
*
* @var mixed
*/
protected $id;
/**
* Presentation.
* Displayed to user.
*
* @var string
*/
protected $presentation;
/**
* {@inheritdoc}
*/
public function getId()
{
return $this->id;
}
/**
* {@inheritdoc}
*/
public function getPresentation()
{
return $this->presentation;
}
/**
* {@inheritdoc}
*/
public function setPresentation($presentation)
{
$this->presentation = $presentation;
return $this;
}
}

View File

@@ -0,0 +1,32 @@
<?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sylius\Component\Attribute\Model;
/**
* @author Gonzalo Vilaseca <gvilaseca@reiss.co.uk>
*/
interface AttributeTranslationInterface
{
/**
* The name displayed to user.
*
* @return string
*/
public function getPresentation();
/**
* Set presentation.
*
* @param string $presentation
*/
public function setPresentation($presentation);
}

View File

@@ -0,0 +1,39 @@
<?php
/*
* This file is part of the Sylius package.
*
* (c); Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sylius\Component\Attribute\Model;
/**
* Default attribute types.
*
* @author Paweł Jędrzejewski <pawel@sylius.org>
*/
class AttributeTypes
{
const CHECKBOX = 'checkbox';
const CHOICE = 'choice';
const MONEY = 'money';
const NUMBER = 'number';
const PERCENTAGE = 'percent';
const TEXT = 'text';
public static function getChoices()
{
return array(
self::CHECKBOX => 'Checkbox',
self::CHOICE => 'Choice',
self::MONEY => 'Money',
self::NUMBER => 'Number',
self::PERCENTAGE => 'Percentage',
self::TEXT => 'Text',
);
}
}

View File

@@ -0,0 +1,172 @@
<?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sylius\Component\Attribute\Model;
/**
* Attribute to subject relation.
*
* @author Paweł Jędrzejewski <pawel@sylius.org>
*/
class AttributeValue implements AttributeValueInterface
{
/**
* Id.
*
* @var integer
*/
protected $id;
/**
* Subject.
*
* @var AttributeSubjectInterface
*/
protected $subject;
/**
* Attribute.
*
* @var AttributeInterface
*/
protected $attribute;
/**
* Attribute value.
*
* @var mixed
*/
protected $value;
/**
* {@inheritdoc}
*/
public function __toString()
{
return $this->value;
}
/**
* {@inheritdoc}
*/
public function getId()
{
return $this->id;
}
/**
* {@inheritdoc}
*/
public function getSubject()
{
return $this->subject;
}
/**
* {@inheritdoc}
*/
public function setSubject(AttributeSubjectInterface $subject = null)
{
$this->subject = $subject;
return $this;
}
/**
* {@inheritdoc}
*/
public function getAttribute()
{
return $this->attribute;
}
/**
* {@inheritdoc}
*/
public function setAttribute(AttributeInterface $attribute)
{
$this->attribute = $attribute;
return $this;
}
/**
* {@inheritdoc}
*/
public function getValue()
{
if ($this->attribute && AttributeTypes::CHECKBOX === $this->attribute->getType()) {
return (Boolean) $this->value;
}
return $this->value;
}
/**
* {@inheritdoc}
*/
public function setValue($value)
{
$this->value = $value;
return $this;
}
/**
* {@inheritdoc}
*/
public function getName()
{
$this->assertAttributeIsSet();
return $this->attribute->getName();
}
/**
* {@inheritdoc}
*/
public function getPresentation()
{
$this->assertAttributeIsSet();
return $this->attribute->getPresentation();
}
/**
* {@inheritdoc}
*/
public function getType()
{
$this->assertAttributeIsSet();
return $this->attribute->getType();
}
/**
* {@inheritdoc}
*/
public function getConfiguration()
{
$this->assertAttributeIsSet();
return $this->attribute->getConfiguration();
}
/**
* @throws \BadMethodCallException When attribute is not set
*/
protected function assertAttributeIsSet()
{
if (null === $this->attribute) {
throw new \BadMethodCallException('The attribute is undefined, so you cannot access proxy methods.');
}
}
}

View File

@@ -0,0 +1,92 @@
<?php
/*
* This file is part of the Sylius package.
*
* (c); Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sylius\Component\Attribute\Model;
/**
* Attribute value model.
*
* This model associates the attribute with its value on the object.
*
* @author Paweł Jędrzejewski <pawel@sylius.org>
*/
interface AttributeValueInterface
{
/**
* Get subject.
*
* @return AttributeSubjectInterface
*/
public function getSubject();
/**
* Set subject.
*
* @param AttributeSubjectInterface|null $subject
*/
public function setSubject(AttributeSubjectInterface $subject = null);
/**
* Get attribute.
*
* @return AttributeInterface
*/
public function getAttribute();
/**
* Set attribute.
*
* @param AttributeInterface $attribute
*/
public function setAttribute(AttributeInterface $attribute);
/**
* Get attribute value.
*
* @return mixed
*/
public function getValue();
/**
* Set attribute value.
*
* @param mixed $value
*/
public function setValue($value);
/**
* Proxy method to access the name from real attribute.
*
* @return string
*/
public function getName();
/**
* Proxy method to access the presentation from real attribute.
*
* @return string
*/
public function getPresentation();
/**
* The type of the attribute.
*
* @return string
*/
public function getType();
/**
* Get attribute configuration.
*
* @return array
*/
public function getConfiguration();
}

47
vendor/sylius/attribute/README.md vendored Normal file
View File

@@ -0,0 +1,47 @@
Attribute Component [![Build status...](https://secure.travis-ci.org/Sylius/Attribute.png?branch=master)](http://travis-ci.org/Sylius/Attribute)
===================
Attributes engine for PHP objects.
Sylius
------
Modern ecommerce for PHP and Symfony2. Visit [Sylius.org](http://sylius.org).
Documentation
-------------
Documentation is available on [**docs.sylius.org**](http://docs.sylius.org/en/latest/components/Attribute/index.html).
Contributing
------------
All instructions for contributing to Sylius can be found in the [Contributing Guide](http://docs.sylius.org/en/latest/contributing/index.html).
Support
-------
If you have a question regarding the usage of this library, please ask on
[Stackoverflow](http://stackoverflow.com). You should use "sylius"
tag when posting and make sure to [browse existing questions](http://stackoverflow.com/questions/tagged/sylius).
Sylius on Twitter
-----------------
[Follow the official Sylius account on Twitter!](http://twitter.com/Sylius).
Bug Tracking
------------
If you find a bug, please refer to the [Reporting a Bug](http://docs.sylius.org/en/latest/contributing/code/bugs.html) guide.
MIT License
-----------
License can be found [here](https://github.com/Sylius/Attribute/blob/master/LICENSE).
Authors
-------
The component was originally created by [Paweł Jędrzejewski](http://pjedrzejewski.com).
See the list of [contributors](https://github.com/Sylius/Attribute/contributors).

44
vendor/sylius/attribute/composer.json vendored Normal file
View File

@@ -0,0 +1,44 @@
{
"name": "sylius/attribute",
"type": "library",
"description": "Component for handling object attributes in PHP projects.",
"keywords": ["shop", "ecommerce", "attribute", "feature"],
"homepage": "http://sylius.org",
"license": "MIT",
"authors": [
{
"name": "Paweł Jędrzejewski",
"homepage": "http://pjedrzejewski.com"
},
{
"name": "Sylius project",
"homepage": "http://sylius.org"
},
{
"name": "Community contributions",
"homepage": "http://github.com/Sylius/Sylius/contributors"
}
],
"require": {
"php": ">=5.3.3",
"sylius/resource": "0.13.*@dev"
},
"require-dev": {
"phpspec/phpspec": "~2.1"
},
"config": {
"bin-dir": "bin"
},
"autoload": {
"psr-4": { "Sylius\\Component\\Attribute\\": "" }
},
"autoload-dev": {
"psr-4": { "Sylius\\Component\\Attribute\\spec\\": "spec/" }
},
"extra": {
"branch-alias": {
"dev-master": "0.13-dev"
}
}
}

5
vendor/sylius/attribute/phpspec.yml vendored Normal file
View File

@@ -0,0 +1,5 @@
suites:
main:
namespace: Sylius\Component\Attribute
psr4_prefix: Sylius\Component\Attribute
src_path: .

View File

@@ -0,0 +1,130 @@
<?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace spec\Sylius\Component\Attribute\Model;
use PhpSpec\ObjectBehavior;
use Sylius\Component\Attribute\Model\AttributeTypes;
/**
* @author Paweł Jędrzejewski <pawel@sylius.org>
* @author Gonzalo Vilaseca <gvilaseca@reiss.co.uk>
*/
class AttributeSpec extends ObjectBehavior
{
public function let()
{
$this->setCurrentLocale('en');
}
function it_is_initializable()
{
$this->shouldHaveType('Sylius\Component\Attribute\Model\Attribute');
}
function it_implements_Sylius_attribute_interface()
{
$this->shouldImplement('Sylius\Component\Attribute\Model\AttributeInterface');
}
function it_has_no_id_by_default()
{
$this->getId()->shouldReturn(null);
}
function it_has_no_name_by_default()
{
$this->getName()->shouldReturn(null);
}
function its_name_is_mutable()
{
$this->setName('T-Shirt collection');
$this->getName()->shouldReturn('T-Shirt collection');
}
function it_returns_name_when_converted_to_string()
{
$this->setName('T-Shirt material');
$this->__toString()->shouldReturn('T-Shirt material');
}
function it_has_no_presentation_by_default()
{
$this->getPresentation()->shouldReturn(null);
}
function its_presentation_is_mutable()
{
$this->setPresentation('Size');
$this->getPresentation()->shouldReturn('Size');
}
function it_has_text_type_by_default()
{
$this->getType()->shouldReturn(AttributeTypes::TEXT);
}
function its_type_is_mutable()
{
$this->setType(AttributeTypes::CHECKBOX);
$this->getType()->shouldReturn(AttributeTypes::CHECKBOX);
}
function it_initializes_empty_configuration_array_by_default()
{
$this->getConfiguration()->shouldReturn(array());
}
function its_configuration_is_mutable()
{
$this->setConfiguration(array('choices' => array('Red', 'Blue')));
$this->getConfiguration()->shouldReturn(array('choices' => array('Red', 'Blue')));
}
function it_initializes_creation_date_by_default()
{
$this->getCreatedAt()->shouldHaveType('DateTime');
}
function its_creation_date_is_mutable()
{
$date = new \DateTime();
$this->setCreatedAt($date);
$this->getCreatedAt()->shouldReturn($date);
}
function it_has_no_last_update_date_by_default()
{
$this->getUpdatedAt()->shouldReturn(null);
}
function its_last_update_date_is_mutable()
{
$date = new \DateTime();
$this->setUpdatedAt($date);
$this->getUpdatedAt()->shouldReturn($date);
}
function it_has_fluent_interface()
{
$date = new \DateTime();
$this->setName('T-Shirt brand')->shouldReturn($this);
$this->setPresentation('Brand')->shouldReturn($this);
$this->setType(AttributeTypes::CHOICE)->shouldReturn($this);
$this->setConfiguration(array())->shouldReturn($this);
$this->setCreatedAt($date)->shouldReturn($this);
$this->setUpdatedAt($date)->shouldReturn($this);
}
}

View File

@@ -0,0 +1,54 @@
<?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace spec\Sylius\Component\Attribute\Model;
use PhpSpec\ObjectBehavior;
use Sylius\Component\Attribute\Model\AttributeTypes;
/**
* @author Gonzalo Vilaseca <gvilaseca@reiss.co.uk>
*/
class AttributeTranslationSpec extends ObjectBehavior
{
function it_is_initializable()
{
$this->shouldHaveType('Sylius\Component\Attribute\Model\AttributeTranslation');
}
function it_implements_Sylius_attribute_interface()
{
$this->shouldImplement('Sylius\Component\Attribute\Model\AttributeTranslationInterface');
}
function it_has_no_id_by_default()
{
$this->getId()->shouldReturn(null);
}
function it_has_no_presentation_by_default()
{
$this->getPresentation()->shouldReturn(null);
}
function its_presentation_is_mutable()
{
$this->setPresentation('Size');
$this->getPresentation()->shouldReturn('Size');
}
function it_has_fluent_interface()
{
$date = new \DateTime();
$this->setPresentation('Brand')->shouldReturn($this);
}
}

View File

@@ -0,0 +1,162 @@
<?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace spec\Sylius\Component\Attribute\Model;
use PhpSpec\ObjectBehavior;
use Sylius\Component\Attribute\Model\AttributeInterface;
use Sylius\Component\Attribute\Model\AttributeSubjectInterface;
use Sylius\Component\Attribute\Model\AttributeTypes;
/**
* @author Paweł Jędrzejewski <pawel@sylius.org>
*/
class AttributeValueSpec extends ObjectBehavior
{
function it_is_initializable()
{
$this->shouldHaveType('Sylius\Component\Attribute\Model\AttributeValue');
}
function it_implements_Sylius_subject_attribute_interface()
{
$this->shouldImplement('Sylius\Component\Attribute\Model\AttributeValueInterface');
}
function it_has_no_id_by_default()
{
$this->getId()->shouldReturn(null);
}
function it_does_not_belong_to_a_subject_by_default()
{
$this->getSubject()->shouldReturn(null);
}
function it_allows_assigning_itself_to_a_subject(AttributeSubjectInterface $subject)
{
$this->setSubject($subject);
$this->getSubject()->shouldReturn($subject);
}
function it_allows_detaching_itself_from_a_subject(AttributeSubjectInterface $subject)
{
$this->setSubject($subject);
$this->getSubject()->shouldReturn($subject);
$this->setSubject(null);
$this->getSubject()->shouldReturn(null);
}
function it_has_no_attribute_defined_by_default()
{
$this->getAttribute()->shouldReturn(null);
}
function its_attribute_is_definable(AttributeInterface $attribute)
{
$this->setAttribute($attribute);
$this->getAttribute()->shouldReturn($attribute);
}
function it_has_no_value_by_default()
{
$this->getValue()->shouldReturn(null);
}
function its_value_is_mutable()
{
$this->setValue('XXL');
$this->getValue()->shouldReturn('XXL');
}
function it_converts_value_to_Boolean_if_attribute_has_checkbox_type(AttributeInterface $attribute)
{
$attribute->getType()->willReturn(AttributeTypes::CHECKBOX);
$this->setAttribute($attribute);
$this->setValue('1');
$this->getValue()->shouldReturn(true);
$this->setValue(0);
$this->getValue()->shouldReturn(false);
}
function it_returns_its_value_when_converted_to_string()
{
$this->setValue('S');
$this->__toString()->shouldReturn('S');
}
function it_throws_exception_when_trying_to_get_name_without_attribute_defined()
{
$this
->shouldThrow('BadMethodCallException')
->duringGetName()
;
}
function it_returns_its_attribute_name(AttributeInterface $attribute)
{
$attribute->getName()->willReturn('T-Shirt material');
$this->setAttribute($attribute);
$this->getName()->shouldReturn('T-Shirt material');
}
function it_throws_exception_when_trying_to_get_presentation_without_attribute_defined()
{
$this
->shouldThrow('BadMethodCallException')
->duringGetPresentation()
;
}
function it_returns_its_attribute_presentation(AttributeInterface $attribute)
{
$attribute->getPresentation()->willReturn('Material');
$this->setAttribute($attribute);
$this->getPresentation()->shouldReturn('Material');
}
function it_throws_exception_when_trying_to_get_type_without_attribute_defined()
{
$this
->shouldThrow('BadMethodCallException')
->duringGetType()
;
}
function it_returns_its_attribute_type(AttributeInterface $attribute)
{
$attribute->getType()->willReturn('choice');
$this->setAttribute($attribute);
$this->getType()->shouldReturn('choice');
}
function it_throws_exception_when_trying_to_get_configuration_without_attribute_defined()
{
$this
->shouldThrow('BadMethodCallException')
->duringGetConfiguration()
;
}
function it_returns_its_attribute_configuration(AttributeInterface $attribute)
{
$attribute->getConfiguration()->willReturn(array('choices' => array('Red')));
$this->setAttribute($attribute);
$this->getConfiguration()->shouldReturn(array('choices' => array('Red')));
}
}