The North East of England's AV festival, a biennial fiesta celebrating the best in electronic arts and encouraging critical dialogue, took the notion of 'energy' for its theme this year. AV separated the contents of this rather vague term, debated across the history of twentieth century art, into four groupings: 'scientific, technological, environmental and spiritual perspectives'. These somewhat forced and regulatory divisions are reminiscent of those categories of the spiritual (or transcendent) and the empirical (or scientific) that Rosalind Krauss aimed to expose and to disrupt in her 1977 essay, 'Grids'. In this paper, Krauss notes the ambivalent status of the grid as a modernist emblem or 'myth', its materialist surface suppressing a potential, metaphysical experience of release. Taking an historical approach, she explains, 'under every modernist grid is a symbolist window parading in the guise of a treatise on optics'.
As part of the AV festival, A Certain Distance, Endless Light works with the theme of energy, with a focus on light that is apparent even before one enters the first gallery space. The porch-like entrance hall is draped with brilliant white strings of household light bulbs, an introduction to the late Felix Gonzalez-Torres' Lightstrings installation. However, in contrast to AV's awkward premise, curator Gavin Delahunty manages to maintain the ambiguity inherent in the history of modernist engagement with light. Each of the exhibition's four rooms are intended to produce very different qualities of light – from hard white to sickly yellow - yet this elusive element is presented within the exhibition as simultaneously, and equally, social, technological, poetic and political, as well as merely beautiful.
William McKeown's first contribution, The Dayroom, is an approximation of a hospital or residential living or waiting room, in which, according to the wall text, one might receive pleasing or devastating news. Constructed cheaply and sparely in wood and board, the simple cubed space appears to make reference not only to commonplace social pressures (and the architecture that contains them) but also specifically to Krauss' treatment of the grid, mentioned earlier. Looking through the makeshift room's only window, a modestly sized blue-grey and yellow grid painting is visible directly in one's line of sight. This viewing position brings to mind the symbolist window, with its desirous, metaphysical implications. Yet, like the painted grid's materialist mapping of the canvas surface, the rough plasterboard and two-by-four supporting the window brings the viewing experience back down to earth all too soon.
This situation of longing and frustration is repeated in Gonzalez-Torres' double stack piece, first shown at Andrea Rosen Gallery, New York in 1990. Two stacks of white paper sit alongside one another. Each sheet contains one of two typed, and seemingly opposed, statements: 'nowhere better than this place' / 'somewhere better than this place'. The interplay between the material (this place) and the ideal (somewhere/nowhere) is again at work here. However, given what we know of Gonzalez-Torres' practice, working as an openly gay and socially concerned artist within the traditionally authoritative conceptual and minimalist vein, this is not merely an abstract philosophical musing. Rather, a socio-political element is harnessed, which MIMA takes as a springboard to focus on 'local aspiration'. The phrase 'local aspiration' perhaps invokes the problematic politics of regeneration entered into by a beautifully designed, glass fronted, young art museum in an area of the North East suffering high unemployment due to decades of industrial and commercial withdrawal.
© Felix Gonzalez-Torres Foundation. Courtesy of Andrea Rosen Gallery, New York.
A couple of installation decisions grate a little. McKeown's succession of seventy monochrome watercolours, The Daisy Field, is breathtaking, especially when one considers that the artist has employed the most basic of raw materials (Fabriano paper and masking tape) to produce the work. However, the curatorial and/or artistic move to include an imposing series of metal barriers around the entire display seems misplaced. Although the barriers arguably link to form a second 'chain', emphasising the daisy-chain analogy, they forcibly overstate the case that the most straightforward equipment may produce a valuable display. Secondly, and perhaps unavoidable, was the papering over of an industrially sized door within the final room with a delicately beautiful billboard image by Gonzalez-Torres. While the image's puckering and bulging might be seen as a conscious indicator, or even a critical reminder, of the museum's less than ideal environment; the market-driven migration of art works; or indeed of loss and decay more generally (a common theme in the artist's oeuvre), the overall effect – as in The Daisy Field – was that of unnecessary disruption.
Despite these, few slip-ups, A Certain Distance, Endless Light is aesthetically and theoretically valuable. Significantly, however, the museum's public interpretation efforts are also a standout quality of the exhibition. The gallery wall texts are printed in a gently comic, unorthodox font and approach their subject with a generous balance of art historical contextualisation, visual and emotive description, and an absolutely non-patronising focus on local community relevance. A simply bound paper booklet accompanies the exhibition. Produced through interactions with museum visitors and staff, including those in the café, gift shop and administrative areas, the booklet is a truly delightful compilation of poems, song lyrics and other texts inspired by the theme of light. In addition, billboards with an image of 'a lone bird, photographed from below, floating effortlessly beneath an overcast sky' were displayed outside of the ideal gallery environment of local cities, Middlesbrough, Sunderland and Newcastle, between 1 and 14 March 2010.
As a final note, for a reviewer with specific interests in the reworking of modernist tropes by contemporary artists, the show highlighted the socio-political, and queer, interests (of the 1990s to the present) that are beginning to be read back into earlier abstract works. I am thinking here of the recent work of David Getsy on David Smith's sculpture, and that of Jonathan Katz and Anna Chave on Agnes Martin's drawing and painting – for whom Krauss' work on the grid's mythical structure is particularly pertinent. In particular, notions of beauty, as rethought in both Gonzalez-Torres' and McKeown's installations, are beginning to be viewed again as enmeshed with the political, social and the everyday.
As Felix Gonzalez-Torres wrote, 'Beauty is a power we should reinvest with our own purpose.' MIMA, in conjunction with two outstanding artists, has executed this task with finesse.


text:
Congress Includes Massive Sale of Oil Reserves in Budget Deal
Kate Wheeling
Congress is expected to vote on a budget deal Thursday that would cut the United States' emergency oil reserves almost in half over the next decade, Bloomberg reports.
The spending deal includes a sale of roughly 100 million barrels of oil from the nation's Strategic Petroleum Reserve, a cache of federally owned oil stockpiled in salt caves along the Gulf Coast of the U.S., to avert crises in the case of supply disruptions. The U.S. government tapped into the supply last year, after Hurricane Harvey shut down refiners in Texas and Louisiana; in 2011, when civil unrest in Libya led to a supply disruption; and in 2005, after Hurricane Katrina.
Now Congress wants to sell off 45 percent of the reserve by 2027 to help to cover budget expenses. It's not the first time legislators have tapped into the reserve for non-energy expenses: A sale of seven million barrels helped pay for the tax cuts passed in December, and, in 2015, Congress sold 25 million barrels to pay for a medical research bill.
Though oil goes for roughly $60 a barrel today, it's impossible to know exactly how much money the 100 million barrels will bring in over the next 10 years given the volatility of oil prices.
FOOTNOTESCongressOilBudgetPoliticsStrategic Petroleum Reserve
Kate Wheeling is a staff writer at Pacific Standard, where she specializes in criminal justice and the environment.
Follow KateWheeling

redpajama_set_name: RedPajamaCommonCrawl


text:
def test_if_interval_list_is_valid(intervals):
    for i, interval in enumerate(intervals):
        if interval[0] > interval[1]:
            return False
        if i > 0:
            if not interval[0] > intervals[i - 1][1]:
                return False
        if i + 1 < len(intervals):
            if not intervals[i + 1][0] > interval[1]:
                return False
    return True

def merge_intervals_from_index(intervals, index):
    cut_position = index + 1
    for i in range(index + 1, len(intervals)):
        if intervals[i][0] <= intervals[index][1]:
            intervals[index][1] = max(intervals[index][1], intervals[i][1])
            cut_position = i + 1
        else:
            break
    del intervals[index + 1: cut_position]

def insert_interval(intervals, new_interval):
    inserted_index = None
    for i, interval in enumerate(intervals):
        if interval[1] < new_interval[0]:
            continue
        if interval[0] > new_interval[1]:
            intervals.insert(i, new_interval)
            inserted_index = i
            break
        if interval[0] <= new_interval[1]:
            intervals[i][0] = min(intervals[i][0], new_interval[0])
            intervals[i][1] = max(intervals[i][1], new_interval[1])
            inserted_index = i
            break
    if inserted_index is not None:
        merge_intervals_from_index(intervals, inserted_index)
    else:
        intervals.append(new_interval)

if __name__ == '__main__':
    interval_list = []
    insertions = [[3, 4], [1, 2], [2, 3], [5, 5], [6, 6], [0, 7]]
    for insertion in insertions:
        insert_interval(interval_list, insertion)
        print(interval_list)
        assert test_if_interval_list_is_valid(interval_list)

# Produces
#  [[3, 4]]
#  [[1, 2], [3, 4]]
#  [[1, 4]]
#  [[1, 4], [5, 5]]
#  [[1, 4], [5, 5], [6, 6]]
#  [[0, 7]]

redpajama_set_name: RedPajamaGithub


text:
Savings and Loans
Our Cornerstones
We believe in change that lasts. And that comes from farmers having control over their resources and the information and expertise to make decisions themselves.
We invest alongside farmers and other partners, building sustainable businesses and inclusive markets that enable farmers to earn a living income.
Financing from the ground up
Working capital is vital to any business – especially farming, where the costs of land, livestock and farm equipment can be significant.
Each self-help group sets up a central fund from which members can borrow money to grow their businesses.
Every time their group meets, members deposit an agreed upon amount with the group's treasurer. As the savings build, members borrow money from the fund, using it to scale up their business, start a new venture, or cover the cost of an emergency.
The groups establish their own governance structures. Many are led by women and
most have a majority women membership. The groups receive financial training from our local
teams and decide for themselves how and where to invest their money.
Total in Savings $ 19,898,669
Self help groups continue investing and lending in a continuous cycle, forming larger cooperatives and eventually apex organizations, shifting from informal to formal over time.
We invest alongside entrepreneurial community members
We have more than 20 years of experience supporting savings and lending groups in 19 countries. Groups are usually women-led, and the majority of membership is comprised of women. They then lend that money to one another to help members meet immediate and long-term needs. While we provide trainings, the groups themselves are self-led, with members setting goals together as they hold each other accountable and build trust amongst themselves.
We work with communities to grow and scale their businesses and progress their market maturity.
Progression of group and market maturity
Heifer currently is involved in projects in 20 countries all over the world.
100% of women
$2,898,429 in savings
1,492 total groups
We consult with local government to identify strategic locations, then forms groups, targeting more vulnerable community members. All community members join a group. Collective work can make up as much as half of a group's savings. Once groups have gone through the full suite of training, we assist them in forming cooperatives.
$400,946 in savings
210 total groups
In Bangladesh, our project team works with local leaders and a community facilitator to form new groups, 100 percent comprised of women members. Group members span the demographics of a community, and VBHCD reinforces their trust and caring for one another. Once groups form cooperatives, they track their financials through Cooperative 360 for access to real-time information.
72% of women
We work with the community to identify project participants, and then facilitates the creation of groups. The projects focus on needy communities including most vulnerable and less vulnerable families who are willing to join the project and meet participation conditions as well. The group savings and lending structure provides accessible capital for members to invest in IGAs, without requiring outside loans at potentially higher interest rates.
29,248 total households
In Cambodia, we primarily leverage and provide training to existing groups. The groups do not participate in fundraising, including only savings in the group fund. Movement into cooperatives is voluntary, occurring through the purchase of shares at either the individual or group level.
In India, we primarily leverage and provide training to existing groups. Most groups start saving within a month of forming. We also help groups form Project Management Committees to represent themselves as they form and register a a producer company with the government. Revolving fund at the producer company level to grow and support more families.
18 total groups
We work with associations in Haiti, rather than the smaller groups, providing training to the associations leadership. In turn, these leaders are responsible for training their members. After training and saving together, participant groups show much greater interest in participating in and taking ownership of community development activities.
In Ghana, we work with existing groups and individuals not yet organized into groups who are in the same social capital development status and who have common interests, even though they might be engaged in different income generating activities. Once there is money in the fund, members can take out loans to cover essential needs or, once essential needs are covered, to invest in income generating activities.
In Kenya, we work with groups that the project helps form, as well as previously existing groups. Some groups use mobile money (e.g. MPESA) to transfer funds to members. This reduces the use of cash, making the group fund more secure. It also assists in transparency, as there is an electronic record of transactions within the group.
Savings groups in Malawi typically have a separate social fund for emergencies or social needs, and groups put stipulations on the amount given per incidence and type of need. Malawi also presents a unique opportunity to compare models. The EPOG project will pilot savings groups which pay out dividends only, and reinvest savings. The challenge will be how this works within the regulatory environment.
270 total members
In Mexico, we primarily leverage and provide training to existing groups who are more established as market systems actors. Training is tailored based on individual groups' needs. To jump-start their savings, we also provide seed capital to the groups. There is great flexibility in annual payout vs. re-capitalization of interest, and groups make the decision on how to operate.
$4,440 in savings
The project is inclusive of producers and members of their families, rather than participants of any particular socio-economic standing. When members take loans, they typically invest in productive activities, which work to provide the means for members to provide adequate nutrition and food for their families. At the end of each year, profits generated by interest of the loans are distributed, and groups typically keep the principle in the fund in order to grow it larger in the next cycle.
In Rwanda, we visit nearby microfinance institutions (MFIs) to identify places where groups would be able to open a savings account. This provides a secure place for groups to store their savings when it is not being lent out. For project farmers to access the market and be able to sign the contracts with buyers, we encourage members from different groups to form cooperatives, for market accessibility and to allow them sign contracts with buyers in future.
In communities where groups exist, we screen them for functionality and retained for assistance. When there are not yet groups, we facilitate their formation. Groups are made up of households within the same socio-economic brackets. As the members' economic power increases, group members may mutually agree to increase the amount of their weekly savings.
We help mobilize farmers to form self-help groups. For farmers to be able to secure a reliable market, they must increase production and ensure the products are of high quality. Some investments require more money than a typical savings group can provide, therefore Heifer Tanzania sometimes links farmers with micro-finance institutions or SACCOS to access larger loans.
We primarily leverage and provide training to existing groups. The groups do not participate in fundraising, including only savings in the group fund. Groups agree on minimum and maximum savings amounts. A key tenant of all groups is that, regardless of the amount a member has saved, he or she has an equal voice in the use of funds.
All groups self-form and are made up of 10 to 15 people. Our target groups are the most vulnerable. However, since the groups are self-selecting and self-organizing, the groups tend to have a mix of the most vulnerable and those in the middle. Groups join with other groups to form cooperatives called Savings and Credit Cooperatives (SACCOs), which give groups access to increased funds and opportunities to grow their savings in a more formal way.
Learn More About Our Model
Learn More About Connection to Markets
Learn More About Technology and Innovation
Learn More About Training


Most industrial sites have wastewater discharges, and most people know those discharges must be permitted under the Clean Water Act (CWA). What many people do not know, including some consultants, is the CWA has a "permit shield" that could protect your company or client from liability to a regulatory agency or as a result of a citizen suit by a third party.
Generally, the CWA imposes a blanket prohibition on all discharges of pollutants to the waters of the U.S. If a discharge occurs, the discharger is in violation of the CWA. The major exception to this prohibition and resulting liability is a discharge that is allowed under a permit issued by EPA or an appropriate state agency. Based on the application submitted, the permit will include a listing of pollutants that may be discharged and the amount of those pollutants that can be discharged. The permittee samples the discharge on a frequency established in the permit and reports the amount of pollutants discharged to the regulatory agency. If the permittee is in compliance with the terms and conditions of the permit, then that compliance is deemed to be in complete compliance with the CWA. Thus, the permittee is protected from enforcement actions by a regulatory agency and citizen suits by third parties.
There are situations, though, in which a permittee may discharge a pollutant that is not mentioned or listed in the permit. A literal application of the CWA would mean the permittee is in violation of the prohibition against discharging that pollutant without a permit. This is where the permit shield comes in. If the permittee is otherwise in compliance with the terms and conditions of the permit, the permittee may escape liability for discharging that pollutant if the discharge of that pollutant was adequately disclosed to the regulatory agency during the permit application process, and the discharge was reasonably contemplated by the agency when the permit was issued. The pollutant, although not listed specifically in the permit, is within the scope of the permit and the permittee is shielded from liability.
Some examples will illustrate the operation of the permit shield. In one case, an environmental group sued a permittee because it was discharging heated water (heat is a pollutant under the CWA) into a river. The permit did not list heat as a pollutant that may be discharged. However, the permittee was found to have disclosed during the application process that it would be discharging heat. As a result, heat was within the scope of the permit even if it was not specifically mentioned therein. In another case, the permittee did not disclose the fact it would discharge selenium. EPA's regulations and its standard form application required the presence or absence of selenium be mentioned in the application. The applicant did not check any box, so the application and the permit were silent regarding selenium. As a result, selenium was not within the scope of the permit and the permittee was found liable in a citizen suit for discharging selenium in violation of the CWA.
Many of the standard form applications for a CWA permit contain lists of pollutants that allow an applicant to indicate whether the pollutant is or may be present. Regardless of whether the application has such a list, any pollutant that may be present in the discharge should be mentioned to the permitting agency, whether in the application itself or in another document submitted during the application process. The agency will decide whether to include a discharge limit for that pollutant. When you are later found by the agency or some environmental group to be discharging that pollutant, you will be able to rely on the permit shield to protect you from liability. For once, the provisions of the CWA will be of some help to you.


text:
Home » 2019 Participants » VAS SARANGA
VAS SARANGA
Co-Creator, Co-Writer
Vas is a South Asian-Canadian screenwriter/actor that was recently named one of "Canada's Rising Stars" by The Hollywood Reporter. As an actor his breakout starring role was as Reese in the live-action television series "Mudpit" (Teletoon). He has also appeared on "The Handmaid's Tale" (Hulu), "Orphan Black" (BBC America), "Salvation" (CBS), "The Girlfriend Experience" (Starz), and the feature comedy "Little Italy" opposite Emma Roberts and Hayden Christensen. Vas is also the lead creative behind the YouTube sketch comedy sensation "3ShadeProductions", where he co-wrote and directed over 30 digital shorts. The channel has over 40,000 subscribers and 10 million total views. Vas has also co-written two feature film screenplays which are currently in development with Third Culture Films.
IMDB: https://www.imdb.com/name/nm2680655/
Vas Twitter/Instagram: @vas_saranga


text:
<?php

namespace ZendTest\Db\TableGateway;

use Zend\Db\TableGateway\AbstractTableGateway;
use Zend\Db\Sql;
use Zend\Db\ResultSet\ResultSet;

/**
 * Generated by PHPUnit_SkeletonGenerator on 2012-03-01 at 21:02:22.
 */
class AbstractTableGatewayTest extends \PHPUnit_Framework_TestCase
{

    /**
     * @var \PHPUnit_Framework_MockObject_Generator
     */
    protected $mockAdapter = null;

    /**
     * @var \PHPUnit_Framework_MockObject_Generator
     */
    protected $mockSql = null;

    /**
     * @var AbstractTableGateway
     */
    protected $table;

    /**
     * Sets up the fixture, for example, opens a network connection.
     * This method is called before a test is executed.
     */
    protected function setUp()
    {
        // mock the adapter, driver, and parts
        $mockResult = $this->getMock('Zend\Db\Adapter\Driver\ResultInterface');
        $mockResult->expects($this->any())->method('getAffectedRows')->will($this->returnValue(5));

        $mockStatement = $this->getMock('Zend\Db\Adapter\Driver\StatementInterface');
        $mockStatement->expects($this->any())->method('execute')->will($this->returnValue($mockResult));

        $mockConnection = $this->getMock('Zend\Db\Adapter\Driver\ConnectionInterface');
        $mockConnection->expects($this->any())->method('getLastGeneratedValue')->will($this->returnValue(10));

        $mockDriver = $this->getMock('Zend\Db\Adapter\Driver\DriverInterface');
        $mockDriver->expects($this->any())->method('createStatement')->will($this->returnValue($mockStatement));
        $mockDriver->expects($this->any())->method('getConnection')->will($this->returnValue($mockConnection));

        $this->mockAdapter = $this->getMock('Zend\Db\Adapter\Adapter', null, array($mockDriver));
        $this->mockSql = $this->getMock('Zend\Db\Sql\Sql', array('select', 'insert', 'update', 'delete'), array($this->mockAdapter, 'foo'));
        $this->mockSql->expects($this->any())->method('select')->will($this->returnValue($this->getMock('Zend\Db\Sql\Select', array('where', 'getRawSate'), array('foo'))));
        $this->mockSql->expects($this->any())->method('insert')->will($this->returnValue($this->getMock('Zend\Db\Sql\Insert', array('prepareStatement', 'values'), array('foo'))));
        $this->mockSql->expects($this->any())->method('update')->will($this->returnValue($this->getMock('Zend\Db\Sql\Update', array('where'), array('foo'))));
        $this->mockSql->expects($this->any())->method('delete')->will($this->returnValue($this->getMock('Zend\Db\Sql\Delete', array('where'), array('foo'))));

        $this->table = $this->getMockForAbstractClass(
            'Zend\Db\TableGateway\AbstractTableGateway'
            //array('getTable')
        );
        $tgReflection = new \ReflectionClass('Zend\Db\TableGateway\AbstractTableGateway');
        foreach ($tgReflection->getProperties() as $tgPropReflection) {
            $tgPropReflection->setAccessible(true);
            switch ($tgPropReflection->getName()) {
                case 'table':
                    $tgPropReflection->setValue($this->table, 'foo');
                    break;
                case 'adapter':
                    $tgPropReflection->setValue($this->table, $this->mockAdapter);
                    break;
                case 'resultSetPrototype':
                    $tgPropReflection->setValue($this->table, new ResultSet);
                    break;
                case 'sql':
                    $tgPropReflection->setValue($this->table, $this->mockSql);
                    break;
            }
        }
    }

    /**
     * Tears down the fixture, for example, closes a network connection.
     * This method is called after a test is executed.
     */
    protected function tearDown()
    {
    }

    /**
     * @covers Zend\Db\TableGateway\AbstractTableGateway::getTable
     */
    public function testGetTable()
    {
        $this->assertEquals('foo', $this->table->getTable());
    }

    /**
     * @covers Zend\Db\TableGateway\AbstractTableGateway::getAdapter
     */
    public function testGetAdapter()
    {
        $this->assertSame($this->mockAdapter, $this->table->getAdapter());
    }

    /**
     * @covers Zend\Db\TableGateway\AbstractTableGateway::getSql
     */
    public function testGetSql()
    {
        $this->assertInstanceOf('Zend\Db\Sql\Sql', $this->table->getSql());
    }

    /**
     * @covers Zend\Db\TableGateway\AbstractTableGateway::getResultSetPrototype
     */
    public function testGetSelectResultPrototype()
    {
        $this->assertInstanceOf('Zend\Db\ResultSet\ResultSet', $this->table->getResultSetPrototype());
    }

    /**
     * @covers Zend\Db\TableGateway\AbstractTableGateway::select
     * @covers Zend\Db\TableGateway\AbstractTableGateway::selectWith
     * @covers Zend\Db\TableGateway\AbstractTableGateway::executeSelect
     */
    public function testSelectWithNoWhere()
    {
        $resultSet = $this->table->select();

        // check return types
        $this->assertInstanceOf('Zend\Db\ResultSet\ResultSet', $resultSet);
        $this->assertNotSame($this->table->getResultSetPrototype(), $resultSet);
    }

    /**
     * @covers Zend\Db\TableGateway\AbstractTableGateway::select
     * @covers Zend\Db\TableGateway\AbstractTableGateway::selectWith
     * @covers Zend\Db\TableGateway\AbstractTableGateway::executeSelect
     */
    public function testSelectWithWhereString()
    {
        $mockSelect = $this->mockSql->select();

        $mockSelect->expects($this->any())
            ->method('getRawState')
            ->will($this->returnValue(array(
                'table' => $this->table->getTable(),
                ))
            );

        // assert select::from() is called
        $mockSelect->expects($this->once())
            ->method('where')
            ->with($this->equalTo('foo'));

        $this->table->select('foo');
    }

    /**
     * @covers Zend\Db\TableGateway\AbstractTableGateway::insert
     * @covers Zend\Db\TableGateway\AbstractTableGateway::insertWith
     * @covers Zend\Db\TableGateway\AbstractTableGateway::executeInsert
     */
    public function testInsert()
    {
        $mockInsert = $this->mockSql->insert();

        $mockInsert->expects($this->once())
            ->method('prepareStatement')
            ->with($this->mockAdapter);

        $mockInsert->expects($this->once())
            ->method('values')
            ->with($this->equalTo(array('foo' => 'bar')));

        $affectedRows = $this->table->insert(array('foo' => 'bar'));
        $this->assertEquals(5, $affectedRows);
    }

    /**
     * @covers Zend\Db\TableGateway\AbstractTableGateway::update
     * @covers Zend\Db\TableGateway\AbstractTableGateway::updateWith
     * @covers Zend\Db\TableGateway\AbstractTableGateway::executeUpdate
     */
    public function testUpdate()
    {
        $mockUpdate = $this->mockSql->update();

        // assert select::from() is called
        $mockUpdate->expects($this->once())
            ->method('where')
            ->with($this->equalTo('id = 2'));

        $affectedRows = $this->table->update(array('foo' => 'bar'), 'id = 2');
        $this->assertEquals(5, $affectedRows);
    }

    /**
     * @covers Zend\Db\TableGateway\AbstractTableGateway::update
     * @covers Zend\Db\TableGateway\AbstractTableGateway::updateWith
     * @covers Zend\Db\TableGateway\AbstractTableGateway::executeUpdate
     */
    public function testUpdateWithNoCriteria()
    {
        $mockUpdate = $this->mockSql->update();

        $affectedRows = $this->table->update(array('foo' => 'bar'));
        $this->assertEquals(5, $affectedRows);
    }

    /**
     * @covers Zend\Db\TableGateway\AbstractTableGateway::delete
     * @covers Zend\Db\TableGateway\AbstractTableGateway::deleteWith
     * @covers Zend\Db\TableGateway\AbstractTableGateway::executeDelete
     */
    public function testDelete()
    {
        $mockDelete = $this->mockSql->delete();

        // assert select::from() is called
        $mockDelete->expects($this->once())
            ->method('where')
            ->with($this->equalTo('foo'));

        $affectedRows = $this->table->delete('foo');
        $this->assertEquals(5, $affectedRows);
    }

    /**
     * @covers Zend\Db\TableGateway\AbstractTableGateway::getLastInsertValue
     */
    public function testGetLastInsertValue()
    {
        $this->table->insert(array('foo' => 'bar'));
        $this->assertEquals(10, $this->table->getLastInsertValue());
    }

    /**
     * @covers Zend\Db\TableGateway\AbstractTableGateway::__get
     */
    public function test__get()
    {
        $this->table->insert(array('foo')); // trigger last insert id update

        $this->assertEquals(10, $this->table->lastInsertValue);
        $this->assertSame($this->mockAdapter, $this->table->adapter);
        //$this->assertEquals('foo', $this->table->table);
    }

    /**
     * @covers Zend\Db\TableGateway\AbstractTableGateway::__clone
     */
    public function test__clone()
    {
        $cTable = clone $this->table;
        $this->assertSame($this->mockAdapter, $cTable->getAdapter());
    }
}