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

Commit 1dab3ea

Browse files
committed
added tests
1 parent e1cbdca commit 1dab3ea

File tree

3 files changed

+52
-20
lines changed

3 files changed

+52
-20
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?php
2+
3+
namespace ZendDiagnosticsTest;
4+
5+
/**
6+
* @author Kevin Bond <[email protected]>
7+
*/
8+
abstract class AbstractMemoryTest extends \PHPUnit_Framework_TestCase
9+
{
10+
/**
11+
* @dataProvider InvalidArgumentProvider
12+
*/
13+
public function testInvalidArguments($warningThreshold, $criticalThreshold)
14+
{
15+
$this->setExpectedException('InvalidArgumentException');
16+
$this->createCheck($warningThreshold, $criticalThreshold);
17+
}
18+
19+
public function InvalidArgumentProvider()
20+
{
21+
return array(
22+
array('Not an integer.', 'Not an integer.'),
23+
array(5, 'Not an integer.'),
24+
array('Not an integer.', 100),
25+
array(-10, 100),
26+
array(105, 100),
27+
array(10, -10),
28+
array(10, 105)
29+
);
30+
}
31+
32+
abstract protected function createCheck($warningThreshold, $criticalThreshold);
33+
}

tests/ZendDiagnosticsTest/ApcMemoryTest.php

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,10 @@
77
/**
88
* @author Kevin Bond <[email protected]>
99
*/
10-
class ApcMemoryTest extends \PHPUnit_Framework_TestCase
10+
class ApcMemoryTest extends AbstractMemoryTest
1111
{
12-
/**
13-
* @dataProvider InvalidArgumentProvider
14-
*/
15-
public function testInvalidArguments($warningThreshold, $criticalThreshold)
12+
protected function createCheck($warningThreshold, $criticalThreshold)
1613
{
17-
$this->setExpectedException('InvalidArgumentException');
18-
new ApcMemory($warningThreshold, $criticalThreshold);
19-
}
20-
21-
public function InvalidArgumentProvider()
22-
{
23-
return array(
24-
array('Not an integer.', 'Not an integer.'),
25-
array(5, 'Not an integer.'),
26-
array('Not an integer.', 100),
27-
array(-10, 100),
28-
array(105, 100),
29-
array(10, -10),
30-
array(10, 105)
31-
);
14+
return new ApcMemory($warningThreshold, $criticalThreshold);
3215
}
3316
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
3+
namespace ZendDiagnosticsTest;
4+
5+
use ZendDiagnostics\Check\OpCacheMemory;
6+
7+
/**
8+
* @author Kevin Bond <[email protected]>
9+
*/
10+
class OpCacheMemoryTest extends AbstractMemoryTest
11+
{
12+
protected function createCheck($warningThreshold, $criticalThreshold)
13+
{
14+
return new OpCacheMemory($warningThreshold, $criticalThreshold);
15+
}
16+
}

0 commit comments

Comments
 (0)