Development

Changeset 30571 for branches/2.0/tests

You must first sign up to be able to contribute.

Show
Ignore:
Timestamp:
08/06/10 19:45:09 (3 years ago)
Author:
fabien
Message:

Merge branch 'master' of git://github.com/symfony/symfony

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/2.0/tests/Symfony/Tests/Components/DependencyInjection/ContainerBuilderTest.php

    r30263 r30571  
    342342 
    343343    /** 
    344      * @covers Symfony\Components\DependencyInjection\ContainerBuilder::findAnnotatedServiceIds 
    345      */ 
    346     public function testFindAnnotatedServiceIds() 
     344     * @covers Symfony\Components\DependencyInjection\ContainerBuilder::findTaggedServiceIds 
     345     */ 
     346    public function testfindTaggedServiceIds() 
    347347    { 
    348348        $builder = new ContainerBuilder(); 
    349349        $builder 
    350350            ->register('foo', 'FooClass') 
    351             ->addAnnotation('foo', array('foo' => 'foo')) 
    352             ->addAnnotation('bar', array('bar' => 'bar')) 
    353             ->addAnnotation('foo', array('foofoo' => 'foofoo')) 
     351            ->addTag('foo', array('foo' => 'foo')) 
     352            ->addTag('bar', array('bar' => 'bar')) 
     353            ->addTag('foo', array('foofoo' => 'foofoo')) 
    354354        ; 
    355         $this->assertEquals($builder->findAnnotatedServiceIds('foo'), array( 
     355        $this->assertEquals($builder->findTaggedServiceIds('foo'), array( 
    356356            'foo' => array( 
    357357                array('foo' => 'foo'), 
    358358                array('foofoo' => 'foofoo'), 
    359359            ) 
    360         ), '->findAnnotatedServiceIds() returns an array of service ids and its annotation attributes'); 
    361         $this->assertEquals(array(), $builder->findAnnotatedServiceIds('foobar'), '->findAnnotatedServiceIds() returns an empty array if there is annotated services'); 
     360        ), '->findTaggedServiceIds() returns an array of service ids and its tag attributes'); 
     361        $this->assertEquals(array(), $builder->findTaggedServiceIds('foobar'), '->findTaggedServiceIds() returns an empty array if there is annotated services'); 
    362362    } 
    363363 
  • branches/2.0/tests/Symfony/Tests/Components/DependencyInjection/DefinitionTest.php

    r30181 r30571  
    119119 
    120120    /** 
    121      * @covers Symfony\Components\DependencyInjection\Definition::clearAnnotation
     121     * @covers Symfony\Components\DependencyInjection\Definition::clearTag
    122122     */ 
    123     public function testClearAnnotations() 
     123    public function testClearTags() 
    124124    { 
    125125        $def = new Definition('stdClass'); 
    126         $this->assertEquals(spl_object_hash($def), spl_object_hash($def->clearAnnotations()), '->clearAnnotations() implements a fluent interface'); 
    127         $def->addAnnotation('foo', array('foo' => 'bar')); 
    128         $def->clearAnnotations(); 
    129         $this->assertEquals(array(), $def->getAnnotations(), '->clearAnnotations() removes all current annotations'); 
     126        $this->assertEquals(spl_object_hash($def), spl_object_hash($def->clearTags()), '->clearTags() implements a fluent interface'); 
     127        $def->addTag('foo', array('foo' => 'bar')); 
     128        $def->clearTags(); 
     129        $this->assertEquals(array(), $def->getTags(), '->clearTags() removes all current tags'); 
    130130    } 
    131131 
    132132    /** 
    133      * @covers Symfony\Components\DependencyInjection\Definition::addAnnotation 
    134      * @covers Symfony\Components\DependencyInjection\Definition::getAnnotation 
    135      * @covers Symfony\Components\DependencyInjection\Definition::getAnnotation
     133     * @covers Symfony\Components\DependencyInjection\Definition::addTag 
     134     * @covers Symfony\Components\DependencyInjection\Definition::getTag 
     135     * @covers Symfony\Components\DependencyInjection\Definition::getTag
    136136     */ 
    137     public function testAnnotations() 
     137    public function testTags() 
    138138    { 
    139139        $def = new Definition('stdClass'); 
    140         $this->assertEquals(array(), $def->getAnnotation('foo'), '->getAnnotation() returns an empty array if the annotation is not defined'); 
    141         $this->assertEquals(spl_object_hash($def), spl_object_hash($def->addAnnotation('foo')), '->addAnnotation() implements a fluent interface'); 
    142         $this->assertEquals(array(array()), $def->getAnnotation('foo'), '->getAnnotation() returns attributes for an annotation name'); 
    143         $def->addAnnotation('foo', array('foo' => 'bar')); 
    144         $this->assertEquals(array(array(), array('foo' => 'bar')), $def->getAnnotation('foo'), '->addAnnotation() can adds the same annotation several times'); 
    145         $def->addAnnotation('bar', array('bar' => 'bar')); 
    146         $this->assertEquals($def->getAnnotations(), array( 
     140        $this->assertEquals(array(), $def->getTag('foo'), '->getTag() returns an empty array if the tag is not defined'); 
     141        $this->assertEquals(spl_object_hash($def), spl_object_hash($def->addTag('foo')), '->addTag() implements a fluent interface'); 
     142        $this->assertEquals(array(array()), $def->getTag('foo'), '->getTag() returns attributes for a tag name'); 
     143        $def->addTag('foo', array('foo' => 'bar')); 
     144        $this->assertEquals(array(array(), array('foo' => 'bar')), $def->getTag('foo'), '->addTag() can adds the same tag several times'); 
     145        $def->addTag('bar', array('bar' => 'bar')); 
     146        $this->assertEquals($def->getTags(), array( 
    147147            'foo' => array(array(), array('foo' => 'bar')), 
    148148            'bar' => array(array('bar' => 'bar')), 
    149         ), '->getAnnotations() returns all annotations'); 
     149        ), '->getTags() returns all tags'); 
    150150    } 
    151151} 
  • branches/2.0/tests/Symfony/Tests/Components/DependencyInjection/Fixtures/containers/container9.php

    r30263 r30571  
    1111$container-> 
    1212    register('foo', 'FooClass')-> 
    13     addAnnotation('foo', array('foo' => 'foo'))-> 
    14     addAnnotation('foo', array('bar' => 'bar'))-> 
     13    addTag('foo', array('foo' => 'foo'))-> 
     14    addTag('foo', array('bar' => 'bar'))-> 
    1515    setFactoryMethod('getInstance')-> 
    1616    setArguments(array('foo', new Reference('foo.baz'), array('%foo%' => 'foo is %foo%', 'bar' => '%foo%'), true, new Reference('service_container')))-> 
  • branches/2.0/tests/Symfony/Tests/Components/DependencyInjection/Fixtures/php/services1-1.php

    r30062 r30571  
    2626 
    2727    /** 
    28      * Returns service ids for a given annotation
     28     * Returns service ids for a given tag
    2929     * 
    30      * @param string $name The annotation name 
     30     * @param string $name The tag name 
    3131     * 
    32      * @return array An array of annotation
     32     * @return array An array of tag
    3333     */ 
    34     public function findAnnotatedServiceIds($name) 
     34    public function findTaggedServiceIds($name) 
    3535    { 
    36         static $annotations = array ( 
     36        static $tags = array ( 
    3737); 
    3838 
    39         return isset($annotations[$name]) ? $annotations[$name] : array(); 
     39        return isset($tags[$name]) ? $tags[$name] : array(); 
    4040    } 
    4141} 
  • branches/2.0/tests/Symfony/Tests/Components/DependencyInjection/Fixtures/php/services1.php

    r30062 r30571  
    2626 
    2727    /** 
    28      * Returns service ids for a given annotation
     28     * Returns service ids for a given tag
    2929     * 
    30      * @param string $name The annotation name 
     30     * @param string $name The tag name 
    3131     * 
    32      * @return array An array of annotation
     32     * @return array An array of tag
    3333     */ 
    34     public function findAnnotatedServiceIds($name) 
     34    public function findTaggedServiceIds($name) 
    3535    { 
    36         static $annotations = array ( 
     36        static $tags = array ( 
    3737); 
    3838 
    39         return isset($annotations[$name]) ? $annotations[$name] : array(); 
     39        return isset($tags[$name]) ? $tags[$name] : array(); 
    4040    } 
    4141} 
  • branches/2.0/tests/Symfony/Tests/Components/DependencyInjection/Fixtures/php/services8.php

    r30263 r30571  
    2626 
    2727    /** 
    28      * Returns service ids for a given annotation
     28     * Returns service ids for a given tag
    2929     * 
    30      * @param string $name The annotation name 
     30     * @param string $name The tag name 
    3131     * 
    32      * @return array An array of annotation
     32     * @return array An array of tag
    3333     */ 
    34     public function findAnnotatedServiceIds($name) 
     34    public function findTaggedServiceIds($name) 
    3535    { 
    36         static $annotations = array ( 
     36        static $tags = array ( 
    3737); 
    3838 
    39         return isset($annotations[$name]) ? $annotations[$name] : array(); 
     39        return isset($tags[$name]) ? $tags[$name] : array(); 
    4040    } 
    4141 
  • branches/2.0/tests/Symfony/Tests/Components/DependencyInjection/Fixtures/php/services9.php

    r30181 r30571  
    154154 
    155155    /** 
    156      * Returns service ids for a given annotation
     156     * Returns service ids for a given tag
    157157     * 
    158      * @param string $name The annotation name 
     158     * @param string $name The tag name 
    159159     * 
    160      * @return array An array of annotation
     160     * @return array An array of tag
    161161     */ 
    162     public function findAnnotatedServiceIds($name) 
     162    public function findTaggedServiceIds($name) 
    163163    { 
    164         static $annotations = array ( 
     164        static $tags = array ( 
    165165  'foo' =>  
    166166  array ( 
     
    179179); 
    180180 
    181         return isset($annotations[$name]) ? $annotations[$name] : array(); 
     181        return isset($tags[$name]) ? $tags[$name] : array(); 
    182182    } 
    183183 
  • branches/2.0/tests/Symfony/Tests/Components/DependencyInjection/Fixtures/xml/services9.xml

    r30181 r30571  
    1111  <services> 
    1212    <service id="foo" class="FooClass" factory-method="getInstance" shared="false"> 
    13       <annotation name="foo" foo="foo" /> 
    14       <annotation name="foo" bar="bar" /> 
     13      <tag name="foo" foo="foo" /> 
     14      <tag name="foo" bar="bar" /> 
    1515      <file>%path%foo.php</file> 
    1616      <argument>foo</argument> 
  • branches/2.0/tests/Symfony/Tests/Components/DependencyInjection/Fixtures/yaml/services9.yml

    r30181 r30571  
    77  foo: 
    88    class: FooClass 
    9     annotations: 
     9    tags: 
    1010      - { name: foo, foo: foo } 
    1111      - { name: foo, bar: bar }