function testCanBuildSpy() { $spy = spy('PhockitoGlobalsTest_MockMe'); $this->assertInstanceOf('PhockitoGlobalsTest_MockMe', $spy); $this->assertEquals($spy->Foo(), 'Foo'); $this->assertEquals($spy->Bar(), 'Bar'); }
function field_collection_item_values($field, $item, $value = 'value', $default = null) { $items = array_first($item['entity']['field_collection_item']); $field = 'field_' . preg_remove('/^field_/', $field); $values = array(); foreach (array_get(array_get($items, $field, array()), '#items', array()) as $item) { if (!array_key_exists($value, $item)) { trigger_error('Value ' . spy($value) . ' does not exist for item ' . spy($item) . '.'); } $values[] = array_get($item, $value, $default); } return $values; }
/** * @expectedException \Exception * @expectedExceptionMessage Base method Foo was called */ function testCanBuildSpy() { $spy = spy(MockMe::class); $this->assertInstanceOf(MockMe::class, $spy); $this->assertEquals($spy->Foo(), 'Foo'); }