/** * Test the "expansion" of filters (converting them to arrays too) * * @covers \Expose\Report::toArray */ public function testObjectToArrayExpandFilters() { $filter = new \Expose\Filter(); $filter->setId(1234); $this->report->addFilterMatch($filter); $result = $this->report->toArray(true); $this->assertTrue(isset($result['filterMatches'][0]) && $result['filterMatches'][0]['id'] === 1234); }
/** * Test the getter for the filter data in collection when requesting a single id * * @covers \Expose\FilterCollection::getFilterData * @covers \Expose\FilterCollection::setFilterData */ public function testGetFilterDataWithId() { $data = array(array('id' => 1234)); $filter = new \Expose\Filter(); $filter->setId(1234); $this->collection->setFilterData($data); $result = $this->collection->getFilterData(1234); $this->assertEquals($filter, $result); }
public function testThresholdHigherThenImpact() { $filter = new \Expose\Filter(); $filter->setImpact(5); $collection = new \Expose\FilterCollection(); $collection->addFilter($filter); $manager_mock = $this->getMockBuilder('\\Expose\\Manager')->setConstructorArgs(array($collection, new \Expose\MockLogger()))->setMethods(array('sendNotification'))->getMock(); $manager_mock->expects($this->never())->method('sendNotification'); $manager_mock->setThreshold(100); $manager_mock->run(array('test' => 'test'), false, true); }
/** * Test that the output of the data in an array is correct * * @covers \Expose\Filter::toArray */ public function testOutputAsArray() { $data = array('id' => 1234, 'rule' => '^foo[0-9]+', 'description' => 'this is a test', 'tags' => array('csrf', 'xss'), 'impact' => 3); $filter = new \Expose\Filter($data); $data['tags'] = 'csrf, xss'; $this->assertEquals($filter->toArray(), $data); }