You are here

function dfpBaseTest::dfpGenerateSize in Doubleclick for Publishers (DFP) 7

Same name and namespace in other branches
  1. 7.2 tests/dfp.test \dfpBaseTest::dfpGenerateSize()

Generate a random size (or array or sizes) to use when testing tags formatted as ###x###.

2 calls to dfpBaseTest::dfpGenerateSize()
dfpBaseTest::dfpBasicTagEditValues in tests/dfp_base.test
Create a simple $edit array to be used on the DFP tag form to create a new DFP tag object.
dfpDisplayTagTest::testDisplayTagWithMapping in tests/dfp_display_tag.test

File

tests/dfp_base.test, line 59
Base test file for DFP module.

Class

dfpBaseTest
@file Base test file for DFP module.

Code

function dfpGenerateSize($count = 1) {
  $sizes = array(
    '300x250',
    '300x600',
    '728x90',
    '728x10',
    '160x600',
    '120x80',
    '300x100',
    '50x50',
    '160x300',
  );
  shuffle($sizes);
  return $count == 1 ? array_pop($sizes) : array_slice($sizes, 0, min($count, count($sizes)));
}