Code Duplication    Length = 13-13 lines in 2 locations

Tests/EncryptionWrapperTest.php 2 locations

@@ 68-80 (lines=13) @@
65
    /**
66
     * @expectedException \Mes\Security\CryptoBundle\Exception\CryptoException
67
     */
68
    public function testEncryptWithKeyEncryptsPlaintextThrowsException()
69
    {
70
        try {
71
            $this->encryption->expects($this->once())
72
                             ->method('encryptWithKey')
73
                             ->with('The quick brown fox jumps over the lazy dog', $this->getMockBuilder('Mes\Security\CryptoBundle\Model\KeyInterface')->getMock())
74
                             ->will($this->throwException(new EnvironmentIsBrokenException()));
75
        } catch (EnvironmentIsBrokenException $e) {
76
            $this->throwException(new CryptoException());
77
        }
78
79
        $this->wrapper->encryptWithKey('The quick brown fox jumps over the lazy dog', $this->getMockBuilder('Mes\Security\CryptoBundle\Model\KeyInterface')->getMock());
80
    }
81
82
    /**
83
     * @throws \Mes\Security\CryptoBundle\Exception\CryptoException
@@ 100-112 (lines=13) @@
97
    /**
98
     * @expectedException \Mes\Security\CryptoBundle\Exception\CryptoException
99
     */
100
    public function testDecryptWithKeyDecryptsCiphertextThrowsException()
101
    {
102
        try {
103
            $this->encryption->expects($this->once())
104
                             ->method('decryptWithKey')
105
                             ->with('ThisIsACipherText', $this->getMockBuilder('Mes\Security\CryptoBundle\Model\KeyInterface')->getMock())
106
                             ->will($this->throwException(new BaseCryptoException()));
107
        } catch (BaseCryptoException $e) {
108
            $this->throwException(new CryptoException());
109
        }
110
111
        $this->wrapper->decryptWithKey('ThisIsACipherText', $this->getMockBuilder('Mes\Security\CryptoBundle\Model\KeyInterface')->getMock());
112
    }
113
114
    /**
115
     * @throws \Mes\Security\CryptoBundle\Exception\CryptoException