Code Duplication    Length = 13-14 lines in 2 locations

src/Test/AbstractEditableDiscoveryTest.php 2 locations

@@ 82-94 (lines=13) @@
79
        return $this->loadDiscoveryFromStorage($discovery);
80
    }
81
82
    public function testAddBinding()
83
    {
84
        $binding = new StringBinding('string', Foo::clazz);
85
86
        $discovery = $this->createDiscovery();
87
        $discovery->addBindingType(new BindingType(Foo::clazz, self::STRING_BINDING));
88
        $discovery->addBinding($binding);
89
90
        $discovery = $this->loadDiscoveryFromStorage($discovery);
91
92
        $this->assertCount(1, $discovery->findBindings(Foo::clazz));
93
        $this->assertCount(1, $discovery->getBindings());
94
    }
95
96
    /**
97
     * @expectedException \Puli\Discovery\Api\Type\NoSuchTypeException
@@ 117-130 (lines=14) @@
114
        $discovery->addBinding(new StringBinding('string', Foo::clazz));
115
    }
116
117
    public function testAddBindingAcceptsDuplicates()
118
    {
119
        // The idea behind accepting duplicates is that depending on the use
120
        // case, multiple modules may define the same binding but the order
121
        // in which the modules is loaded is important. Hence if we load
122
        // [m1, m2, m3] and m1 and m3 contain the same binding, we cannot simply
123
        // discard one of the bindings, since the order might be important for
124
        // the end user.
125
126
        $binding = new StringBinding('string', Foo::clazz);
127
128
        $discovery = $this->createDiscovery();
129
        $discovery->addBindingType(new BindingType(Foo::clazz, self::STRING_BINDING));
130
        $discovery->addBinding($binding);
131
        $discovery->addBinding($binding);
132
133
        $discovery = $this->loadDiscoveryFromStorage($discovery);