How to use foo class

Best Atoum code snippet using foo

InlineTest.php

Source:InlineTest.php Github

copy

Full Screen

...78 * @expectedException \Symfony\Component\Yaml\Exception\ParseException79 */80 public function testParseInvalidMappingKeyShouldThrowException()81 {82 $value = '{ "foo " bar": "bar" }';83 Inline::parse($value);84 }85 /**86 * @expectedException \Symfony\Component\Yaml\Exception\ParseException87 */88 public function testParseInvalidMappingShouldThrowException()89 {90 Inline::parse('[foo] bar');91 }92 /**93 * @expectedException \Symfony\Component\Yaml\Exception\ParseException94 */95 public function testParseInvalidSequenceShouldThrowException()96 {97 Inline::parse('{ foo: bar } bar');98 }99 public function testParseScalarWithCorrectlyQuotedStringShouldReturnString()100 {101 $value = "'don''t do somthin'' like that'";102 $expect = "don't do somthin' like that";103 $this->assertSame($expect, Inline::parseScalar($value));104 }105 /**106 * @dataProvider getDataForParseReferences107 */108 public function testParseReferences($yaml, $expected)109 {110 $this->assertSame($expected, Inline::parse($yaml, false, false, false, array('var' => 'var-value')));111 }112 public function getDataForParseReferences()113 {114 return array(115 'scalar' => array('*var', 'var-value'),116 'list' => array('[ *var ]', array('var-value')),117 'list-in-list' => array('[[ *var ]]', array(array('var-value'))),118 'map-in-list' => array('[ { key: *var } ]', array(array('key' => 'var-value'))),119 'embedded-mapping-in-list' => array('[ key: *var ]', array(array('key' => 'var-value'))),120 'map' => array('{ key: *var }', array('key' => 'var-value')),121 'list-in-map' => array('{ key: [*var] }', array('key' => array('var-value'))),122 'map-in-map' => array('{ foo: { bar: *var } }', array('foo' => array('bar' => 'var-value'))),123 );124 }125 public function testParseMapReferenceInSequence()126 {127 $foo = array(128 'a' => 'Steve',129 'b' => 'Clark',130 'c' => 'Brian',131 );132 $this->assertSame(array($foo), Inline::parse('[*foo]', false, false, false, array('foo' => $foo)));133 }134 /**135 * @expectedException \Symfony\Component\Yaml\Exception\ParseException136 * @expectedExceptionMessage A reference must contain at least one character.137 */138 public function testParseUnquotedAsterisk()139 {140 Inline::parse('{ foo: * }');141 }142 /**143 * @expectedException \Symfony\Component\Yaml\Exception\ParseException144 * @expectedExceptionMessage A reference must contain at least one character.145 */146 public function testParseUnquotedAsteriskFollowedByAComment()147 {148 Inline::parse('{ foo: * #foo }');149 }150 /**151 * @dataProvider getDataForIsHash152 */153 public function testIsHash($array, $expected)154 {155 $this->assertSame($expected, Inline::isHash($array));156 }157 public function getDataForIsHash()158 {159 return array(160 array(array(), false),161 array(array(1, 2, 3), false),162 array(array(2 => 1, 1 => 2, 0 => 3), true),163 array(array('foo' => 1, 'bar' => 2), true),164 );165 }166 public function getTestsForParse()167 {168 return array(169 array('', ''),170 array('null', null),171 array('false', false),172 array('true', true),173 array('12', 12),174 array('-12', -12),175 array('"quoted string"', 'quoted string'),176 array("'quoted string'", 'quoted string'),177 array('12.30e+02', 12.30e+02),178 array('0x4D2', 0x4D2),179 array('02333', 02333),180 array('.Inf', -log(0)),181 array('-.Inf', log(0)),182 array("'686e444'", '686e444'),183 array('686e444', 646e444),184 array('123456789123456789123456789123456789', '123456789123456789123456789123456789'),185 array('"foo\r\nbar"', "foo\r\nbar"),186 array("'foo#bar'", 'foo#bar'),187 array("'foo # bar'", 'foo # bar'),188 array("'#cfcfcf'", '#cfcfcf'),189 array('::form_base.html.twig', '::form_base.html.twig'),190 // Pre-YAML-1.2 booleans191 array("'y'", 'y'),192 array("'n'", 'n'),193 array("'yes'", 'yes'),194 array("'no'", 'no'),195 array("'on'", 'on'),196 array("'off'", 'off'),197 array('2007-10-30', gmmktime(0, 0, 0, 10, 30, 2007)),198 array('2007-10-30T02:59:43Z', gmmktime(2, 59, 43, 10, 30, 2007)),199 array('2007-10-30 02:59:43 Z', gmmktime(2, 59, 43, 10, 30, 2007)),200 array('1960-10-30 02:59:43 Z', gmmktime(2, 59, 43, 10, 30, 1960)),201 array('1730-10-30T02:59:43Z', gmmktime(2, 59, 43, 10, 30, 1730)),202 array('"a \\"string\\" with \'quoted strings inside\'"', 'a "string" with \'quoted strings inside\''),203 array("'a \"string\" with ''quoted strings inside'''", 'a "string" with \'quoted strings inside\''),204 // sequences205 // urls are no key value mapping. see #3609. Valid yaml "key: value" mappings require a space after the colon206 array('[foo, http://urls.are/no/mappings, false, null, 12]', array('foo', 'http://urls.are/no/mappings', false, null, 12)),207 array('[ foo , bar , false , null , 12 ]', array('foo', 'bar', false, null, 12)),208 array('[\'foo,bar\', \'foo bar\']', array('foo,bar', 'foo bar')),209 // mappings210 array('{foo:bar,bar:foo,false:false,null:null,integer:12}', array('foo' => 'bar', 'bar' => 'foo', 'false' => false, 'null' => null, 'integer' => 12)),211 array('{ foo : bar, bar : foo, false : false, null : null, integer : 12 }', array('foo' => 'bar', 'bar' => 'foo', 'false' => false, 'null' => null, 'integer' => 12)),212 array('{foo: \'bar\', bar: \'foo: bar\'}', array('foo' => 'bar', 'bar' => 'foo: bar')),213 array('{\'foo\': \'bar\', "bar": \'foo: bar\'}', array('foo' => 'bar', 'bar' => 'foo: bar')),214 array('{\'foo\'\'\': \'bar\', "bar\"": \'foo: bar\'}', array('foo\'' => 'bar', 'bar"' => 'foo: bar')),215 array('{\'foo: \': \'bar\', "bar: ": \'foo: bar\'}', array('foo: ' => 'bar', 'bar: ' => 'foo: bar')),216 // nested sequences and mappings217 array('[foo, [bar, foo]]', array('foo', array('bar', 'foo'))),218 array('[foo, {bar: foo}]', array('foo', array('bar' => 'foo'))),219 array('{ foo: {bar: foo} }', array('foo' => array('bar' => 'foo'))),220 array('{ foo: [bar, foo] }', array('foo' => array('bar', 'foo'))),221 array('[ foo, [ bar, foo ] ]', array('foo', array('bar', 'foo'))),222 array('[{ foo: {bar: foo} }]', array(array('foo' => array('bar' => 'foo')))),223 array('[foo, [bar, [foo, [bar, foo]], foo]]', array('foo', array('bar', array('foo', array('bar', 'foo')), 'foo'))),224 array('[foo, {bar: foo, foo: [foo, {bar: foo}]}, [foo, {bar: foo}]]', array('foo', array('bar' => 'foo', 'foo' => array('foo', array('bar' => 'foo'))), array('foo', array('bar' => 'foo')))),225 array('[foo, bar: { foo: bar }]', array('foo', '1' => array('bar' => array('foo' => 'bar')))),226 array('[foo, \'@foo.baz\', { \'%foo%\': \'foo is %foo%\', bar: \'%foo%\' }, true, \'@service_container\']', array('foo', '@foo.baz', array('%foo%' => 'foo is %foo%', 'bar' => '%foo%'), true, '@service_container')),227 );228 }229 public function getTestsForParseWithMapObjects()230 {231 return array(232 array('', ''),233 array('null', null),234 array('false', false),235 array('true', true),236 array('12', 12),237 array('-12', -12),238 array('"quoted string"', 'quoted string'),239 array("'quoted string'", 'quoted string'),240 array('12.30e+02', 12.30e+02),241 array('0x4D2', 0x4D2),242 array('02333', 02333),243 array('.Inf', -log(0)),244 array('-.Inf', log(0)),245 array("'686e444'", '686e444'),246 array('686e444', 646e444),247 array('123456789123456789123456789123456789', '123456789123456789123456789123456789'),248 array('"foo\r\nbar"', "foo\r\nbar"),249 array("'foo#bar'", 'foo#bar'),250 array("'foo # bar'", 'foo # bar'),251 array("'#cfcfcf'", '#cfcfcf'),252 array('::form_base.html.twig', '::form_base.html.twig'),253 array('2007-10-30', gmmktime(0, 0, 0, 10, 30, 2007)),254 array('2007-10-30T02:59:43Z', gmmktime(2, 59, 43, 10, 30, 2007)),255 array('2007-10-30 02:59:43 Z', gmmktime(2, 59, 43, 10, 30, 2007)),256 array('1960-10-30 02:59:43 Z', gmmktime(2, 59, 43, 10, 30, 1960)),257 array('1730-10-30T02:59:43Z', gmmktime(2, 59, 43, 10, 30, 1730)),258 array('"a \\"string\\" with \'quoted strings inside\'"', 'a "string" with \'quoted strings inside\''),259 array("'a \"string\" with ''quoted strings inside'''", 'a "string" with \'quoted strings inside\''),260 // sequences261 // urls are no key value mapping. see #3609. Valid yaml "key: value" mappings require a space after the colon262 array('[foo, http://urls.are/no/mappings, false, null, 12]', array('foo', 'http://urls.are/no/mappings', false, null, 12)),263 array('[ foo , bar , false , null , 12 ]', array('foo', 'bar', false, null, 12)),264 array('[\'foo,bar\', \'foo bar\']', array('foo,bar', 'foo bar')),265 // mappings266 array('{foo:bar,bar:foo,false:false,null:null,integer:12}', (object) array('foo' => 'bar', 'bar' => 'foo', 'false' => false, 'null' => null, 'integer' => 12)),267 array('{ foo : bar, bar : foo, false : false, null : null, integer : 12 }', (object) array('foo' => 'bar', 'bar' => 'foo', 'false' => false, 'null' => null, 'integer' => 12)),268 array('{foo: \'bar\', bar: \'foo: bar\'}', (object) array('foo' => 'bar', 'bar' => 'foo: bar')),269 array('{\'foo\': \'bar\', "bar": \'foo: bar\'}', (object) array('foo' => 'bar', 'bar' => 'foo: bar')),270 array('{\'foo\'\'\': \'bar\', "bar\"": \'foo: bar\'}', (object) array('foo\'' => 'bar', 'bar"' => 'foo: bar')),271 array('{\'foo: \': \'bar\', "bar: ": \'foo: bar\'}', (object) array('foo: ' => 'bar', 'bar: ' => 'foo: bar')),272 // nested sequences and mappings273 array('[foo, [bar, foo]]', array('foo', array('bar', 'foo'))),274 array('[foo, {bar: foo}]', array('foo', (object) array('bar' => 'foo'))),275 array('{ foo: {bar: foo} }', (object) array('foo' => (object) array('bar' => 'foo'))),276 array('{ foo: [bar, foo] }', (object) array('foo' => array('bar', 'foo'))),277 array('[ foo, [ bar, foo ] ]', array('foo', array('bar', 'foo'))),278 array('[{ foo: {bar: foo} }]', array((object) array('foo' => (object) array('bar' => 'foo')))),279 array('[foo, [bar, [foo, [bar, foo]], foo]]', array('foo', array('bar', array('foo', array('bar', 'foo')), 'foo'))),280 array('[foo, {bar: foo, foo: [foo, {bar: foo}]}, [foo, {bar: foo}]]', array('foo', (object) array('bar' => 'foo', 'foo' => array('foo', (object) array('bar' => 'foo'))), array('foo', (object) array('bar' => 'foo')))),281 array('[foo, bar: { foo: bar }]', array('foo', '1' => (object) array('bar' => (object) array('foo' => 'bar')))),282 array('[foo, \'@foo.baz\', { \'%foo%\': \'foo is %foo%\', bar: \'%foo%\' }, true, \'@service_container\']', array('foo', '@foo.baz', (object) array('%foo%' => 'foo is %foo%', 'bar' => '%foo%'), true, '@service_container')),283 array('{}', new \stdClass()),284 array('{ foo : bar, bar : {} }', (object) array('foo' => 'bar', 'bar' => new \stdClass())),285 array('{ foo : [], bar : {} }', (object) array('foo' => array(), 'bar' => new \stdClass())),286 array('{foo: \'bar\', bar: {} }', (object) array('foo' => 'bar', 'bar' => new \stdClass())),287 array('{\'foo\': \'bar\', "bar": {}}', (object) array('foo' => 'bar', 'bar' => new \stdClass())),288 array('{\'foo\': \'bar\', "bar": \'{}\'}', (object) array('foo' => 'bar', 'bar' => '{}')),289 array('[foo, [{}, {}]]', array('foo', array(new \stdClass(), new \stdClass()))),290 array('[foo, [[], {}]]', array('foo', array(array(), new \stdClass()))),291 array('[foo, [[{}, {}], {}]]', array('foo', array(array(new \stdClass(), new \stdClass()), new \stdClass()))),292 array('[foo, {bar: {}}]', array('foo', '1' => (object) array('bar' => new \stdClass()))),293 );294 }295 public function getTestsForDump()296 {297 return array(298 array('null', null),299 array('false', false),300 array('true', true),301 array('12', 12),302 array("'quoted string'", 'quoted string'),303 array('!!float 1230', 12.30e+02),304 array('1234', 0x4D2),305 array('1243', 02333),306 array('.Inf', -log(0)),307 array('-.Inf', log(0)),308 array("'686e444'", '686e444'),309 array('"foo\r\nbar"', "foo\r\nbar"),310 array("'foo#bar'", 'foo#bar'),311 array("'foo # bar'", 'foo # bar'),312 array("'#cfcfcf'", '#cfcfcf'),313 array("'a \"string\" with ''quoted strings inside'''", 'a "string" with \'quoted strings inside\''),314 array("'-dash'", '-dash'),315 array("'-'", '-'),316 // Pre-YAML-1.2 booleans317 array("'y'", 'y'),318 array("'n'", 'n'),319 array("'yes'", 'yes'),320 array("'no'", 'no'),321 array("'on'", 'on'),322 array("'off'", 'off'),323 // sequences324 array('[foo, bar, false, null, 12]', array('foo', 'bar', false, null, 12)),325 array('[\'foo,bar\', \'foo bar\']', array('foo,bar', 'foo bar')),326 // mappings327 array('{ foo: bar, bar: foo, \'false\': false, \'null\': null, integer: 12 }', array('foo' => 'bar', 'bar' => 'foo', 'false' => false, 'null' => null, 'integer' => 12)),328 array('{ foo: bar, bar: \'foo: bar\' }', array('foo' => 'bar', 'bar' => 'foo: bar')),329 // nested sequences and mappings330 array('[foo, [bar, foo]]', array('foo', array('bar', 'foo'))),331 array('[foo, [bar, [foo, [bar, foo]], foo]]', array('foo', array('bar', array('foo', array('bar', 'foo')), 'foo'))),332 array('{ foo: { bar: foo } }', array('foo' => array('bar' => 'foo'))),333 array('[foo, { bar: foo }]', array('foo', array('bar' => 'foo'))),334 array('[foo, { bar: foo, foo: [foo, { bar: foo }] }, [foo, { bar: foo }]]', array('foo', array('bar' => 'foo', 'foo' => array('foo', array('bar' => 'foo'))), array('foo', array('bar' => 'foo')))),335 array('[foo, \'@foo.baz\', { \'%foo%\': \'foo is %foo%\', bar: \'%foo%\' }, true, \'@service_container\']', array('foo', '@foo.baz', array('%foo%' => 'foo is %foo%', 'bar' => '%foo%'), true, '@service_container')),336 array('{ foo: { bar: { 1: 2, baz: 3 } } }', array('foo' => array('bar' => array(1 => 2, 'baz' => 3)))),337 );338 }339}...

Full Screen

Full Screen

DotenvTest.php

Source:DotenvTest.php Github

copy

Full Screen

...31 $tests = array(32 array('FOO=BAR BAZ', "A value containing spaces must be surrounded by quotes in \".env\" at line 1.\n...FOO=BAR BAZ...\n ^ line 1 offset 11"),33 array('FOO BAR=BAR', "Whitespace are not supported after the variable name in \".env\" at line 1.\n...FOO BAR=BAR...\n ^ line 1 offset 3"),34 array('FOO', "Missing = in the environment variable declaration in \".env\" at line 1.\n...FOO...\n ^ line 1 offset 3"),35 array('FOO="foo', "Missing quote to end the value in \".env\" at line 1.\n...FOO=\"foo...\n ^ line 1 offset 8"),36 array('FOO=\'foo', "Missing quote to end the value in \".env\" at line 1.\n...FOO='foo...\n ^ line 1 offset 8"),37 array('export FOO', "Unable to unset an environment variable in \".env\" at line 1.\n...export FOO...\n ^ line 1 offset 10"),38 array('FOO=${FOO', "Unclosed braces on variable expansion in \".env\" at line 1.\n...FOO=\${FOO...\n ^ line 1 offset 9"),39 );40 if ('\\' !== \DIRECTORY_SEPARATOR) {41 $tests[] = array('FOO=$((1dd2))', "Issue expanding a command (%s\n) in \".env\" at line 1.\n...FOO=$((1dd2))...\n ^ line 1 offset 13");42 }43 return $tests;44 }45 /**46 * @dataProvider getEnvData47 */48 public function testParse($data, $expected)49 {50 $dotenv = new Dotenv();51 $this->assertSame($expected, $dotenv->parse($data));52 }53 public function getEnvData()54 {55 putenv('LOCAL=local');56 $_ENV['REMOTE'] = 'remote';57 $tests = array(58 // backslashes59 array('FOO=foo\\\\bar', array('FOO' => 'foo\\bar')),60 array("FOO='foo\\\\bar'", array('FOO' => 'foo\\\\bar')),61 array('FOO="foo\\\\bar"', array('FOO' => 'foo\\bar')),62 // escaped backslash in front of variable63 array("BAR=bar\nFOO=foo\\\\\$BAR", array('BAR' => 'bar', 'FOO' => 'foo\\bar')),64 array("BAR=bar\nFOO='foo\\\\\$BAR'", array('BAR' => 'bar', 'FOO' => 'foo\\\\$BAR')),65 array("BAR=bar\nFOO=\"foo\\\\\$BAR\"", array('BAR' => 'bar', 'FOO' => 'foo\\bar')),66 array('FOO=foo\\\\\\$BAR', array('FOO' => 'foo\\$BAR')),67 array('FOO=\'foo\\\\\\$BAR\'', array('FOO' => 'foo\\\\\\$BAR')),68 array('FOO="foo\\\\\\$BAR"', array('FOO' => 'foo\\$BAR')),69 // spaces70 array('FOO=bar', array('FOO' => 'bar')),71 array(' FOO=bar ', array('FOO' => 'bar')),72 array('FOO=', array('FOO' => '')),73 array("FOO=\n\n\nBAR=bar", array('FOO' => '', 'BAR' => 'bar')),74 array('FOO= ', array('FOO' => '')),75 array("FOO=\nBAR=bar", array('FOO' => '', 'BAR' => 'bar')),76 // newlines77 array("\n\nFOO=bar\r\n\n", array('FOO' => 'bar')),78 array("FOO=bar\r\nBAR=foo", array('FOO' => 'bar', 'BAR' => 'foo')),79 array("FOO=bar\rBAR=foo", array('FOO' => 'bar', 'BAR' => 'foo')),80 array("FOO=bar\nBAR=foo", array('FOO' => 'bar', 'BAR' => 'foo')),81 // quotes82 array("FOO=\"bar\"\n", array('FOO' => 'bar')),83 array("FOO=\"bar'foo\"\n", array('FOO' => 'bar\'foo')),84 array("FOO='bar'\n", array('FOO' => 'bar')),85 array("FOO='bar\"foo'\n", array('FOO' => 'bar"foo')),86 array("FOO=\"bar\\\"foo\"\n", array('FOO' => 'bar"foo')),87 array('FOO="bar\nfoo"', array('FOO' => "bar\nfoo")),88 array('FOO="bar\rfoo"', array('FOO' => "bar\rfoo")),89 array('FOO=\'bar\nfoo\'', array('FOO' => 'bar\nfoo')),90 array('FOO=\'bar\rfoo\'', array('FOO' => 'bar\rfoo')),91 array('FOO=" FOO "', array('FOO' => ' FOO ')),92 array('FOO=" "', array('FOO' => ' ')),93 array('PATH="c:\\\\"', array('PATH' => 'c:\\')),94 array("FOO=\"bar\nfoo\"", array('FOO' => "bar\nfoo")),95 array('FOO=BAR\\"', array('FOO' => 'BAR"')),96 array("FOO=BAR\\'BAZ", array('FOO' => "BAR'BAZ")),97 array('FOO=\\"BAR', array('FOO' => '"BAR')),98 // concatenated values99 array("FOO='bar''foo'\n", array('FOO' => 'barfoo')),100 array("FOO='bar '' baz'", array('FOO' => 'bar baz')),101 array("FOO=bar\nBAR='baz'\"\$FOO\"", array('FOO' => 'bar', 'BAR' => 'bazbar')),102 array("FOO='bar '\\'' baz'", array('FOO' => "bar ' baz")),103 // comments104 array("#FOO=bar\nBAR=foo", array('BAR' => 'foo')),105 array("#FOO=bar # Comment\nBAR=foo", array('BAR' => 'foo')),106 array("FOO='bar foo' # Comment", array('FOO' => 'bar foo')),107 array("FOO='bar#foo' # Comment", array('FOO' => 'bar#foo')),108 array("# Comment\r\nFOO=bar\n# Comment\nBAR=foo", array('FOO' => 'bar', 'BAR' => 'foo')),109 array("FOO=bar # Another comment\nBAR=foo", array('FOO' => 'bar', 'BAR' => 'foo')),110 array("FOO=\n\n# comment\nBAR=bar", array('FOO' => '', 'BAR' => 'bar')),111 array('FOO=NOT#COMMENT', array('FOO' => 'NOT#COMMENT')),112 array('FOO= # Comment', array('FOO' => '')),113 // edge cases (no conversions, only strings as values)114 array('FOO=0', array('FOO' => '0')),115 array('FOO=false', array('FOO' => 'false')),116 array('FOO=null', array('FOO' => 'null')),117 // export118 array('export FOO=bar', array('FOO' => 'bar')),119 array(' export FOO=bar', array('FOO' => 'bar')),120 // variable expansion121 array("FOO=BAR\nBAR=\$FOO", array('FOO' => 'BAR', 'BAR' => 'BAR')),122 array("FOO=BAR\nBAR=\"\$FOO\"", array('FOO' => 'BAR', 'BAR' => 'BAR')),123 array("FOO=BAR\nBAR='\$FOO'", array('FOO' => 'BAR', 'BAR' => '$FOO')),124 array("FOO_BAR9=BAR\nBAR=\$FOO_BAR9", array('FOO_BAR9' => 'BAR', 'BAR' => 'BAR')),125 array("FOO=BAR\nBAR=\${FOO}Z", array('FOO' => 'BAR', 'BAR' => 'BARZ')),126 array("FOO=BAR\nBAR=\$FOO}", array('FOO' => 'BAR', 'BAR' => 'BAR}')),127 array("FOO=BAR\nBAR=\\\$FOO", array('FOO' => 'BAR', 'BAR' => '$FOO')),128 array('FOO=" \\$ "', array('FOO' => ' $ ')),129 array('FOO=" $ "', array('FOO' => ' $ ')),130 array('BAR=$LOCAL', array('BAR' => 'local')),131 array('BAR=$REMOTE', array('BAR' => 'remote')),132 array('FOO=$NOTDEFINED', array('FOO' => '')),133 );134 if ('\\' !== \DIRECTORY_SEPARATOR) {135 $tests = array_merge($tests, array(136 // command expansion137 array('FOO=$(echo foo)', array('FOO' => 'foo')),138 array('FOO=$((1+2))', array('FOO' => '3')),139 array('FOO=FOO$((1+2))BAR', array('FOO' => 'FOO3BAR')),140 array('FOO=$(echo "$(echo "$(echo "$(echo foo)")")")', array('FOO' => 'foo')),141 array("FOO=$(echo \"Quotes won't be a problem\")", array('FOO' => 'Quotes won\'t be a problem')),142 array("FOO=bar\nBAR=$(echo \"FOO is \$FOO\")", array('FOO' => 'bar', 'BAR' => 'FOO is bar')),143 ));144 }145 return $tests;146 }147 public function testLoad()148 {149 unset($_ENV['FOO']);150 unset($_ENV['BAR']);151 unset($_SERVER['FOO']);152 unset($_SERVER['BAR']);153 putenv('FOO');154 putenv('BAR');155 @mkdir($tmpdir = sys_get_temp_dir().'/dotenv');156 $path1 = tempnam($tmpdir, 'sf-');157 $path2 = tempnam($tmpdir, 'sf-');158 file_put_contents($path1, 'FOO=BAR');159 file_put_contents($path2, 'BAR=BAZ');160 (new Dotenv())->load($path1, $path2);161 $foo = getenv('FOO');162 $bar = getenv('BAR');163 putenv('FOO');164 putenv('BAR');165 unlink($path1);166 unlink($path2);167 rmdir($tmpdir);168 $this->assertSame('BAR', $foo);169 $this->assertSame('BAZ', $bar);170 }171 /**172 * @expectedException \Symfony\Component\Dotenv\Exception\PathException173 */174 public function testLoadDirectory()175 {176 $dotenv = new Dotenv();177 $dotenv->load(__DIR__);178 }179 public function testServerSuperglobalIsNotOverriden()180 {181 $originalValue = $_SERVER['argc'];182 $dotenv = new Dotenv();183 $dotenv->populate(array('argc' => 'new_value'));184 $this->assertSame($originalValue, $_SERVER['argc']);185 }186 public function testEnvVarIsNotOverriden()187 {188 putenv('TEST_ENV_VAR=original_value');189 $_SERVER['TEST_ENV_VAR'] = 'original_value';190 $dotenv = new Dotenv();191 $dotenv->populate(array('TEST_ENV_VAR' => 'new_value'));192 $this->assertSame('original_value', getenv('TEST_ENV_VAR'));193 }194 public function testHttpVarIsPartiallyOverriden()195 {196 $_SERVER['HTTP_TEST_ENV_VAR'] = 'http_value';197 $dotenv = new Dotenv();198 $dotenv->populate(array('HTTP_TEST_ENV_VAR' => 'env_value'));199 $this->assertSame('env_value', getenv('HTTP_TEST_ENV_VAR'));200 $this->assertSame('env_value', $_ENV['HTTP_TEST_ENV_VAR']);201 $this->assertSame('http_value', $_SERVER['HTTP_TEST_ENV_VAR']);202 }203 public function testMemorizingLoadedVarsNamesInSpecialVar()204 {205 // Special variable not exists206 unset($_ENV['SYMFONY_DOTENV_VARS']);207 unset($_SERVER['SYMFONY_DOTENV_VARS']);208 putenv('SYMFONY_DOTENV_VARS');209 unset($_ENV['APP_DEBUG']);210 unset($_SERVER['APP_DEBUG']);211 putenv('APP_DEBUG');212 unset($_ENV['DATABASE_URL']);213 unset($_SERVER['DATABASE_URL']);214 putenv('DATABASE_URL');215 $dotenv = new Dotenv();216 $dotenv->populate(array('APP_DEBUG' => '1', 'DATABASE_URL' => 'mysql://root@localhost/db'));217 $this->assertSame('APP_DEBUG,DATABASE_URL', getenv('SYMFONY_DOTENV_VARS'));218 // Special variable has a value219 $_ENV['SYMFONY_DOTENV_VARS'] = 'APP_ENV';220 $_SERVER['SYMFONY_DOTENV_VARS'] = 'APP_ENV';221 putenv('SYMFONY_DOTENV_VARS=APP_ENV');222 $_ENV['APP_DEBUG'] = '1';223 $_SERVER['APP_DEBUG'] = '1';224 putenv('APP_DEBUG=1');225 unset($_ENV['DATABASE_URL']);226 unset($_SERVER['DATABASE_URL']);227 putenv('DATABASE_URL');228 $dotenv = new Dotenv();229 $dotenv->populate(array('APP_DEBUG' => '0', 'DATABASE_URL' => 'mysql://root@localhost/db'));230 $dotenv->populate(array('DATABASE_URL' => 'sqlite:///somedb.sqlite'));231 $this->assertSame('APP_ENV,DATABASE_URL', getenv('SYMFONY_DOTENV_VARS'));232 }233 public function testOverridingEnvVarsWithNamesMemorizedInSpecialVar()234 {235 putenv('SYMFONY_DOTENV_VARS='.$_SERVER['SYMFONY_DOTENV_VARS'] = 'FOO,BAR,BAZ');236 putenv('FOO=foo');237 putenv('BAR=bar');238 putenv('BAZ=baz');239 putenv('DOCUMENT_ROOT=/var/www');240 $dotenv = new Dotenv();241 $dotenv->populate(array('FOO' => 'foo1', 'BAR' => 'bar1', 'BAZ' => 'baz1', 'DOCUMENT_ROOT' => '/boot'));242 $this->assertSame('foo1', getenv('FOO'));243 $this->assertSame('bar1', getenv('BAR'));244 $this->assertSame('baz1', getenv('BAZ'));245 $this->assertSame('/var/www', getenv('DOCUMENT_ROOT'));246 }247}...

Full Screen

Full Screen

foo

Using AI Code Generation

copy

Full Screen

1$foo = new foo();2$foo->bar();3$foo = new foo();4$foo->bar();5$foo = new foo();6$foo->bar();7$foo = new foo();8$foo->bar();9$foo = new foo();10$foo->bar();11$foo = new foo();12$foo->bar();13$foo = new foo();14$foo->bar();15$foo = new foo();16$foo->bar();17$foo = new foo();18$foo->bar();19$foo = new foo();20$foo->bar();21$foo = new foo();22$foo->bar();23$foo = new foo();24$foo->bar();25$foo = new foo();26$foo->bar();27$foo = new foo();28$foo->bar();29$foo = new foo();30$foo->bar();31$foo = new foo();32$foo->bar();33$foo = new foo();34$foo->bar();

Full Screen

Full Screen

foo

Using AI Code Generation

copy

Full Screen

1usrrAtoum\: C;annot redeclare class Atoum\foo in /home/.../Atoum/foo.php on line 22s2\;3$foo = new foo();4Idon' knwithiishe same prble, b/t I hav Paosimil reorobl>m:bI(havahat is dincseverdlot=sns.wI foothesame infoveralotests, s> I have to include the class in each teft filo.oIstreha way : 1incl2dphthenlyncc,oand netoin e-cbrtsfil?5Idn'tknw ihreiscdoworkaroun , bunwIothinkthishld boofixed.r();6Thisia prblemwith tum. i/Pnt nfoounit.>Aba(m i) a t;stramewrk, nt unit tetingramework. intcdolibrary,=i ei aooramewrk

Full Screen

Full Screen

foo

Using AI Code Generation

copy

Full Screen

1use Foo;cho'ba'2/e Foo;3use Foo;4use Foo;5use Foo;6use Foo;7use Foo;8use Foo;9use Foo;10use Foo;11use Foo;12use Foo;

Full Screen

Full Screen

foo

Using AI Code Generation

copy

Full Screen

1require_once 'atoum.php';2$foo = new foo();3$foo->bar();4require_once 'phpunit.php';5$foo = new foo();6$foo->bar();7use Foo;o class of Atoum8require_once 'atoum.php';9$foo = new foo();10$foo->bar();11require_once 'phpunit.php';12$foo = new foo();13$foo->bar();14require_once 'atoum.php';15$foo = new foo();16$foo->bar();17require_once 'phpunit.php';18$foo = new foo();19$foo->bar();20require_once 'atoum.php';21$foo = new foo();22$foo->bar();23require_once 'phpunit.php';24$foo = new foo();25$foo->bar();26use Foo;27use Foo;28use Foo;29use Foo;30use Foo;31use Foo;32use Foo;33use Foo;34use Foo;35use Foo;36use Foo;

Full Screen

Full Screen

foo

Using AI Code Generation

copy

Full Screen

1use atoum\atoum\test;2{3 public function testFoo()4 {5 ->given($foo = new foo())6 ->if($foo->ba())7 ->objct($foo)8 ->isIntanceOf('foo')9 ;10 }11}12{13 public function bar()14 {15 return true;16 }17}18require 'Atoum/foo.php';19$foo = new foo();20$foo->bar();

Full Screen

Full Screen

foo

Using AI Code Generation

copy

Full Screen

1require_once 'atoum';2$foo = new foo();3$foo->bar();4require_once 'phpunit.php';5$foo = new foo();6$foo->bar();7require_once 'atoum.php';8$foo = new foo();9$foo->bar();10require_once 'phpunit.php';11$foo = new foo();12$foo->bar();13require_once 'atoum.php';14$foo = new foo();15$foo->bar();16require_once 'phpunit.php';17$foo = new foo();18$foo->bar();19require_once 'atoum.php';20$foo = new foo();21$foo->bar();22require_once 'phpunit.php';23$foo = new foo();24$foo->bar();

Full Screen

Full Screen

foo

Using AI Code Generation

copy

Full Screen

1use Atoum;2$foo = new Foo();3$foo->bar();4use PHPUnit;5$foo = new Foo();6$foo->bar();

Full Screen

Full Screen

foo

Using AI Code Generation

copy

Full Screen

1use Foo;2use Foo;3use Foo;4use Foo;5use Foo;6use Foo;7use Foo;8use Foo;9use Foo;10use Foo;11use Foo;12use Foo;13use Foo;14use Foo;15use Foo;16use Foo;17use Foo;18use Foo;19use Foo;20use Foo;21use Foo;22use Foo;23use Foo;24use Foo;

Full Screen

Full Screen

foo

Using AI Code Generation

copy

Full Screen

1use atoum\atoum\test;2{3 public function testFoo()4 {5 ->given($foo = new foo())6 ->if($foo->bar())7 ->object($foo)8 ->isInstanceOf('foo')9 ;10 }11}12{13 public function bar()14 {15 return true;16 }17}

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Atoum automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Most used methods in foo

Run Selenium Automation Tests on LambdaTest Cloud Grid

Trigger Selenium automation tests on a cloud-based Grid of 3000+ real browsers and operating systems.

Test now for Free

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful