summaryrefslogtreecommitdiff
path: root/tests/php/phpt/variables/004-store-scalar-variables.phpt
blob: 53cc6814c080341c50d0df23c3b0e5507e02ef97 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
--TEST--
Test variables defined in PHP-CPP
--DESCRIPTION--
in PHP-CPP:
Php::Value scalar_store(void) {
    
    Php::Value value1 = 1234;
    Php::Value value2 = "this is a string";
    Php::Value value3 = std::string("another string");
    Php::Value value4 = nullptr;
    Php::Value value5 = 123.45;
    Php::Value value6 = true;
    
    Php::Value r;
    r[0] = value1;
    r[1] = value2;
    r[2] = value3;
    r[3] = value4;
    r[4] = value5;
    r[5] = value6;
    
    r[6]  = 1234;
    r[7]  = "this is a string";
    r[8]  = std::string("another string");
    r[9]  = nullptr;        // NULL
    r[10] = Php::Value();   // NULL
    r[11] = 123.45;
    r[12] = false;
    
    return r;
}

--SKIPIF--
<?php if (!extension_loaded("extension_for_tests")) print "skip"; ?>
--FILEEOF--
<?php


var_export(TestVariables\scalar_store());


//echo PHP_EOL;
--EXPECT--
array (
  0 => 1234,
  1 => 'this is a string',
  2 => 'another string',
  3 => NULL,
  4 => 123.45,
  5 => true,
  6 => 1234,
  7 => 'this is a string',
  8 => 'another string',
  9 => NULL,
  10 => NULL,
  11 => 123.45,
  12 => false,
)