Skip to content
This repository was archived by the owner on Jan 29, 2020. It is now read-only.

Commit 80ccc9b

Browse files
committed
Merge branch 'remove-tests-catch-fail' of https://github.com/Maks3w/zf2 into hotfix/tests-exceptions
11 parents fa80520 + 4009aca + ad280cb + b0d3db4 + 9b28224 + 49a871c + 4145ab4 + ff8e603 + abd0527 + 9dc2f89 + 1b81c38 commit 80ccc9b

File tree

2 files changed

+14
-44
lines changed

2 files changed

+14
-44
lines changed

test/Adapter/DbTableTest.php

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -114,12 +114,8 @@ public function testAuthenticateFailureIdentityNotFound()
114114
$this->_adapter->setIdentity('non_existent_username');
115115
$this->_adapter->setCredential('my_password');
116116

117-
try {
118-
$result = $this->_adapter->authenticate();
119-
$this->assertEquals(Authentication\Result::FAILURE_IDENTITY_NOT_FOUND, $result->getCode());
120-
} catch (Adapter\Exception\RuntimeException $e) {
121-
$this->fail('Exception should have been thrown');
122-
}
117+
$result = $this->_adapter->authenticate();
118+
$this->assertEquals(Authentication\Result::FAILURE_IDENTITY_NOT_FOUND, $result->getCode());
123119
}
124120

125121
/**
@@ -134,12 +130,8 @@ public function testAuthenticateFailureIdentityAmbiguous()
134130
$this->_adapter->setIdentity('my_username');
135131
$this->_adapter->setCredential('my_password');
136132

137-
try {
138-
$result = $this->_adapter->authenticate();
139-
$this->assertEquals(Authentication\Result::FAILURE_IDENTITY_AMBIGUOUS, $result->getCode());
140-
} catch (Adapter\Exception\RuntimeException $e) {
141-
$this->fail('Exception should have been thrown');
142-
}
133+
$result = $this->_adapter->authenticate();
134+
$this->assertEquals(Authentication\Result::FAILURE_IDENTITY_AMBIGUOUS, $result->getCode());
143135
}
144136

145137
/**
@@ -208,12 +200,9 @@ public function testAdapterCanUseModifiedDbSelectObject()
208200
$select->where('1 = 0');
209201
$this->_adapter->setIdentity('my_username');
210202
$this->_adapter->setCredential('my_password');
211-
try {
212-
$result = $this->_adapter->authenticate();
213-
$this->assertEquals(Authentication\Result::FAILURE_IDENTITY_NOT_FOUND, $result->getCode());
214-
} catch (Adapter\Exception\RuntimeException $e) {
215-
$this->fail('Exception should have been thrown');
216-
}
203+
204+
$result = $this->_adapter->authenticate();
205+
$this->assertEquals(Authentication\Result::FAILURE_IDENTITY_NOT_FOUND, $result->getCode());
217206
}
218207

219208
/**

test/Adapter/Http/ObjectTest.php

Lines changed: 7 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -110,32 +110,13 @@ public function setUp()
110110

111111
public function testValidConfigs()
112112
{
113-
try {
114-
$t = new Adapter\Http($this->_basicConfig);
115-
} catch (Adapter\Exception\ExceptionInterface $e) {
116-
$this->fail('Valid config deemed invalid');
117-
}
118-
$this->assertFalse(empty($t));
119-
$this->assertInstanceOf('Zend\\Authentication\\Adapter\\Http', $t);
120-
unset($t);
121-
122-
try {
123-
$t = new Adapter\Http($this->_digestConfig);
124-
} catch (Adapter\Exception\ExceptionInterface $e) {
125-
$this->fail('Valid config deemed invalid');
126-
}
127-
$this->assertFalse(empty($t));
128-
$this->assertInstanceOf('Zend\\Authentication\\Adapter\\Http', $t);
129-
unset($t);
130-
131-
try {
132-
$t = new Adapter\Http($this->_bothConfig);
133-
} catch (Adapter\Exception\ExceptionInterface $e) {
134-
$this->fail('Valid config deemed invalid');
135-
}
136-
$this->assertFalse(empty($t));
137-
$this->assertInstanceOf('Zend\\Authentication\\Adapter\\Http', $t);
138-
unset($t);
113+
$configs = array (
114+
$this->_basicConfig,
115+
$this->_digestConfig,
116+
$this->_bothConfig,
117+
);
118+
foreach($configs as $config)
119+
new Adapter\Http($config);
139120
}
140121

141122
public function testInvalidConfigs()

0 commit comments

Comments
 (0)