Code Duplication    Length = 23-23 lines in 2 locations

tests/Mapper/CatalogMapperTest.php 2 locations

@@ 69-91 (lines=23) @@
66
     * @expectedException Wambo\Catalog\Error\CatalogException
67
     * @expectedExceptionMessageRegExp /Cannot add a second product with the SKU '.+'/
68
     */
69
    public function getCatalog_ArrayWithDuplicateSKUGiven_CatalogExceptionIsThrown()
70
    {
71
        // arrange
72
        $catalogData = [
73
            ["sku" => "0001"],
74
            ["sku" => "0002"],
75
            ["sku" => "0001"],
76
        ];
77
78
        $productMapperMock = $this->getMockBuilder(ProductMapper::class)->disableOriginalConstructor()->getMock();
79
        $productMapperMock->method("getProduct")->will($this->onConsecutiveCalls(
80
            new Product(new SKU("0001"), new Slug("product-1"), new Content("Title", "Summary")),
81
            new Product(new SKU("0002"), new Slug("product-2"), new Content("Title", "Summary")),
82
            new Product(new SKU("0001"), new Slug("product-1a"), new Content("Title", "Summary")))
83
        );
84
85
        /** @var ProductMapper $productMapperMock A product mapper instance */
86
87
        $productMapper = new CatalogMapper($productMapperMock);
88
89
        // act
90
        $productMapper->getCatalog($catalogData);
91
    }
92
93
    /**
94
     * If the the given product catalog data contains products with duplicate Slugs a
@@ 102-124 (lines=23) @@
99
     * @expectedException Wambo\Catalog\Error\CatalogException
100
     * @expectedExceptionMessageRegExp /Cannot add a second product with the Slug 'product-1'/
101
     */
102
    public function getCatalog_ArrayWithDuplicateSlugsGiven_CatalogExceptionIsThrown()
103
    {
104
        // arrange
105
        $catalogData = [
106
            ["sku" => "0001"],
107
            ["sku" => "0002"],
108
            ["sku" => "0003"],
109
        ];
110
111
        $productMapperMock = $this->getMockBuilder(ProductMapper::class)->disableOriginalConstructor()->getMock();
112
        $productMapperMock->method("getProduct")->will($this->onConsecutiveCalls(
113
            new Product(new SKU("0001"), new Slug("product-1"), new Content("Title", "Summary")),
114
            new Product(new SKU("0002"), new Slug("product-2"), new Content("Title", "Summary")),
115
            new Product(new SKU("0003"), new Slug("product-1"), new Content("Title", "Summary")))
116
        );
117
118
        /** @var ProductMapper $productMapperMock A product mapper instance */
119
120
        $productMapper = new CatalogMapper($productMapperMock);
121
122
        // act
123
        $productMapper->getCatalog($catalogData);
124
    }
125
126
    /**
127
     * If the the given product catalog data contains products with similar SKUs a